!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexuiplugin=e();}(undefined,(function(){function t(t,i,n){return i=f(i),g(t,e()?Reflect.construct(i,n||[],f(t).constructor):i.apply(t,n))}function e(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));}catch(t){}return (e=function(){return !!t})()}function i(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n);}return i}function n(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){c(t,e,n[e]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e));}));}return t}function s(){s=function(){return e};var t,e={},i=Object.prototype,n=i.hasOwnProperty,r=Object.defineProperty||function(t,e,i){t[e]=i.value;},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",h=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function u(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"");}catch(t){u=function(t,e,i){return t[e]=i};}function c(t,e,i,n){var s=e&&e.prototype instanceof m?e:m,o=Object.create(s.prototype),a=new R(n||[]);return r(o,"_invoke",{value:O(t,i,a)}),o}function d(t,e,i){try{return {type:"normal",arg:t.call(e,i)}}catch(t){return {type:"throw",arg:t}}}e.wrap=c;var f="suspendedStart",p="suspendedYield",v="executing",g="completed",y={};function m(){}function k(){}function b(){}var x={};u(x,a,(function(){return this}));var C=Object.getPrototypeOf,w=C&&C(C(L([])));w&&w!==i&&n.call(w,a)&&(x=w);var S=b.prototype=m.prototype=Object.create(x);function P(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}));}));}function T(t,e){function i(s,r,o,a){var h=d(t[s],t,r);if("throw"!==h.type){var l=h.arg,u=l.value;return u&&"object"==typeof u&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,o,a);}),(function(t){i("throw",t,o,a);})):e.resolve(u).then((function(t){l.value=t,o(l);}),(function(t){return i("throw",t,o,a)}))}a(h.arg);}var s;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,s){i(t,n,e,s);}))}return s=s?s.then(r,r):r()}});}function O(e,i,n){var s=f;return function(r,o){if(s===v)throw new Error("Generator is already running");if(s===g){if("throw"===r)throw o;return {value:t,done:!0}}for(n.method=r,n.arg=o;;){var a=n.delegate;if(a){var h=M(a,n);if(h){if(h===y)continue;return h}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(s===f)throw s=g,n.arg;n.dispatchException(n.arg);}else "return"===n.method&&n.abrupt("return",n.arg);s=v;var l=d(e,i,n);if("normal"===l.type){if(s=n.done?g:p,l.arg===y)continue;return {value:l.arg,done:n.done}}"throw"===l.type&&(s=g,n.method="throw",n.arg=l.arg);}}}function M(e,i){var n=i.method,s=e.iterator[n];if(s===t)return i.delegate=null,"throw"===n&&e.iterator.return&&(i.method="return",i.arg=t,M(e,i),"throw"===i.method)||"return"!==n&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var r=d(s,e.iterator,i.arg);if("throw"===r.type)return i.method="throw",i.arg=r.arg,i.delegate=null,y;var o=r.arg;return o?o.done?(i[e.resultName]=o.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=t),i.delegate=null,y):o:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,y)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0);}function L(e){if(e||""===e){var i=e[a];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var s=-1,r=function i(){for(;++s<e.length;)if(n.call(e,s))return i.value=e[s],i.done=!1,i;return i.value=t,i.done=!0,i};return r.next=r}}throw new TypeError(typeof e+" is not iterable")}return k.prototype=b,r(S,"constructor",{value:b,configurable:!0}),r(b,"constructor",{value:k,configurable:!0}),k.displayName=u(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return !!e&&(e===k||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return {__await:t}},P(T.prototype),u(T.prototype,h,(function(){return this})),e.AsyncIterator=T,e.async=function(t,i,n,s,r){void 0===r&&(r=Promise);var o=new T(c(t,i,n,s),r);return e.isGeneratorFunction(i)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},P(S),u(S,l,"Generator"),u(S,a,(function(){return this})),u(S,"toString",(function(){return "[object Generator]"})),e.keys=function(t){var e=Object(t),i=[];for(var n in e)i.push(n);return i.reverse(),function t(){for(;i.length;){var n=i.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=L,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(_),!e)for(var i in this)"t"===i.charAt(0)&&n.call(this,i)&&!isNaN(+i.slice(1))&&(this[i]=t);},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var i=this;function s(n,s){return a.type="throw",a.arg=e,i.next=n,s&&(i.method="next",i.arg=t),!!s}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return s("end");if(o.tryLoc<=this.prev){var h=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(h&&l){if(this.prev<o.catchLoc)return s(o.catchLoc,!0);if(this.prev<o.finallyLoc)return s(o.finallyLoc)}else if(h){if(this.prev<o.catchLoc)return s(o.catchLoc,!0)}else {if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return s(o.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var r=s;break}}r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=t,o.arg=e,r?(this.method="next",this.next=r.finallyLoc,y):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return "break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),_(i),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var n=i.completion;if("throw"===n.type){var s=n.arg;_(i);}return s}}throw new Error("illegal catch attempt")},delegateYield:function(e,i,n){return this.delegate={iterator:L(e),resultName:i,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function r(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===e?String:Number)(t)}(t,"string");return "symbol"==typeof e?e:String(e)}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e,i,n,s,r,o){try{var a=t[r](o),h=a.value;}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(n,s);}function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,r(n.key),n);}}function u(t,e,i){return e&&l(t.prototype,e),i&&l(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(t,e,i){return (e=r(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function d(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e);}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function v(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return v(t)}function y(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}function m(){return m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var n=y(t,e);if(n){var s=Object.getOwnPropertyDescriptor(n,e);return s.get?s.get.call(arguments.length<3?t:i):s.value}},m.apply(this,arguments)}function k(t,e,i,n){return k="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,i,n){var s,r=y(t,e);if(r){if((s=Object.getOwnPropertyDescriptor(r,e)).set)return s.set.call(n,i),!0;if(!s.writable)return !1}if(s=Object.getOwnPropertyDescriptor(n,e)){if(!s.writable)return !1;s.value=i,Object.defineProperty(n,e,s);}else c(n,e,i);return !0},k(t,e,i,n)}function b(t,e,i,n,s){if(!k(t,e,i,n||t)&&s)throw new TypeError("failed to set property");return i}function x(t,e){return S(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,s,r,o,a=[],h=!0,l=!1;try{if(r=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;h=!1;}else for(;!(h=(n=r.call(i)).done)&&(a.push(n.value),a.length!==e);h=!0);}catch(t){l=!0,s=t;}finally{try{if(!h&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(l)throw s}}return a}}(t,e)||T(t,e)||M()}function C(t){return S(t)||P(t)||T(t)||M()}function w(t){return function(t){if(Array.isArray(t))return O(t)}(t)||P(t)||T(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(t){if(Array.isArray(t))return t}function P(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function T(t,e){if(t){if("string"==typeof t)return O(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return "Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?O(t,e):void 0}}function O(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function M(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var E=function(){function t(e){h(this,t),this.scene=e,this.displayList=e.sys.displayList,this.updateList=e.sys.updateList,e.events.once("destroy",this.destroy,this);}return u(t,[{key:"destroy",value:function(){this.scene=null,this.displayList=null,this.updateList=null;}}],[{key:"register",value:function(e,i){t.prototype[e]=i;}}]),t}(),_=function(t,e,i){return "__BASE"===i?"".concat(t,",").concat(e):"".concat(i,":").concat(t,",").concat(e)},R=function t(e){var i,n,s;if(null==e||"object"!==o(e))return e;if(i=Array.isArray(e)?[]:{},function(t){if("object"!==o(t)||t.nodeType||t===t.window)return !1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(e))for(s in e)n=e[s],i[s]=t(n);else i=e;return i},L=Phaser.Utils.Objects.IsPlainObject,B=Phaser.Utils.Objects.GetValue,D=function(t){return "string"==typeof t&&(t=I[t]),t},I={scale:0,repeat:1},j=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},z=function(){},A={_beginDraw:z,_drawImage:z,_drawTileSprite:z,_endDraw:z,setGetFrameNameCallback:function(t){return void 0===t&&(t=_),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,n){Array.isArray(e)&&(n=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],n=[arguments[4],void 0,arguments[5]]):(i=R(i),n=R(n)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=n,this.rows.count=n?n.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var s=this.scene.sys.textures.get(t);if(!s)return this.clear(),this;if(!i||!n)return this.clear(),this;for(var r=s.get(e),a=r.width,h=0,l=0,u=i.length;l<u;l++)void 0===i[l]?h++:"number"==typeof i[l]?a-=i[l]:a-=i[l].width;var c=a/h,d=r.height,f=0;for(l=0,u=n.length;l<u;l++)void 0===n[l]?f++:"number"==typeof n[l]?d-=n[l]:d-=n[l].width;for(var p,v,g,y,m,k=d/f,b=0,x=0,C=0,w=n.length;C<w;C++){void 0===n[C]&&(n[C]=k),"number"==typeof n[C]&&(n[C]={height:n[C],stretch:C%2}),g=(p=n[C]).height,this.rows.stretch+=0|p.stretch,this.rows.minHeight+=p.stretch>0?0:g,b=0;l=0;for(var S=i.length;l<S;l++){if(void 0===i[l]&&(i[l]=c),"number"==typeof i[l]&&(i[l]={width:i[l],stretch:l%2}),y=(v=i[l]).width,0===C&&(this.columns.stretch+=0|v.stretch,this.columns.minWidth+=v.stretch>0?0:y),y>=1&&g>=1){var P=o(m=this.getFrameNameCallback(l,C,e));"string"!==P&&"number"!==P||s.add(m,0,b+r.cutX,x+r.cutY,y,g);}b+=y;}x+=g;}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,n,s,r,o,a,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var p=Math.min(d,f);if(d>p){var v=(d-p)*h;u>=0?u+=v:u=v,d=p;}if(f>p){var g=(f-p)*l;c>=0?c+=g:c=g,f=p;}}this.columns.scale=d,this.rows.scale=f,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var y=0,m=0;this._beginDraw();for(var k=0,b=this.rows.count;k<b;k++){a=0===(r=this.rows.data[k]).stretch?r.height*f:i*r.stretch,y=0;for(var x=0,C=this.columns.count;x<C;x++)o=0===(s=this.columns.data[x]).stretch?s.width*d:e*s.stretch,n=this.getFrameNameCallback(x,k,this.baseFrameName),t.has(n)&&o>0&&a>0&&(0===(0===r.stretch&&0===s.stretch||0===this.getStretchMode(x,k)?0:1)?this._drawImage(this.textureKey,n,y,m,o,a):this._drawTileSprite(this.textureKey,n,y,m,o,a)),y+=o;m+=a;}this._endDraw();},setStretchMode:function(t){return L(t)?(this.stretchMode.edge=D(B(t,"edge",0)),this.stretchMode.internal=D(B(t,"internal",0))):(t=D(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return j.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}},F=Phaser.Utils.Objects.IsPlainObject,W=Phaser.Utils.Objects.GetValue,V=function(e,i){var n=function(e){function n(e,s,r,o,a,l,u,c,d,f){var p;if(h(this,n),F(s)?(s=W(f=s,"x",0),r=W(f,"y",0),o=W(f,"width",1),a=W(f,"height",1),l=W(f,"key",void 0),u=W(f,"baseFrame",void 0),c=W(f,"columns",void 0),d=W(f,"rows",void 0)):F(o)?(o=W(f=o,"width",1),a=W(f,"height",1),l=W(f,"key",void 0),u=W(f,"baseFrame",void 0),c=W(f,"columns",void 0),d=W(f,"rows",void 0)):F(l)?(l=W(f=l,"key",void 0),u=W(f,"baseFrame",void 0),c=W(f,"columns",void 0),d=W(f,"rows",void 0)):F(u)?(u=W(f=u,"baseFrame",void 0),c=W(f,"columns",void 0),d=W(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=W(f,"baseFrame",void 0)):F(c)&&(c=W(f=c,"columns",void 0),d=W(f,"rows",void 0)),void 0===c){var v=W(f,"leftWidth",void 0),g=W(f,"rightWidth",void 0);void 0!==v&&void 0!==g&&(c=[v,void 0,g]);}if(void 0===d){var y=W(f,"topHeight",void 0),m=W(f,"bottomHeight",void 0);void 0!==y&&void 0!==m&&(d=[y,void 0,m]);}(p=t(this,n,[e])).type=i,p.setPosition(s,r).setSize(o,a).setOrigin(.5,.5),p.columns={},p.rows={},p.stretchMode={},p._tileSprite=void 0,p._image=void 0,p.setGetFrameNameCallback(W(f,"getFrameNameCallback",void 0)),p.setStretchMode(W(f,"stretchMode",0)),p.setPreserveRatio(W(f,"preserveRatio",!0));var k=W(f,"maxFixedPartScale",1),b=W(f,"maxFixedPartScaleX",k),x=W(f,"maxFixedPartScaleY",void 0);return p.setMaxFixedPartScale(b,x),p.setBaseTexture(l,u,c,d),p}return d(n,e),u(n,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(m(f(n.prototype),"resize",this)?m(f(n.prototype),"resize",this).call(this,t,e):m(f(n.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),n}(e);return Object.assign(n.prototype,A),n},Y=Phaser.Game,G=function(t){return t instanceof Y},X=Phaser.Scene,H=function(t){return t instanceof X},U=function(t){return null==t||"object"!==o(t)?null:G(t)?t:G(t.game)?t.game:H(t)?t.sys.game:H(t.scene)?t.scene.sys.game:void 0},N=Phaser.GameObjects,K=void 0,J=function(t,e){if(K||(K={},U(t).events.once("destroy",(function(){for(var t in K)K[t].destroy();K=void 0;}))),!K.hasOwnProperty(e)){var i=U(t).scene.systemScene;(t=new N[e](i)).setOrigin(0),K[e]=t;}return K[e]},q=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i)}(V(Phaser.GameObjects.RenderTexture,"rexNinePatch")),Z={_drawImage:function(t,e,i,n,s,r){var o=J(this,"Image").setTexture(t,e).setDisplaySize(s,r);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,s,r){var o=J(this,"TileSprite").setTexture(t,e).setSize(s,r);this.draw(o,i,n);}};Object.assign(q.prototype,Z);var $=function(t){return null==t||""===t||0===t.length},Q=function(t,e,i,n){if(void 0===n&&(n="."),"object"===o(t)){if($(e)){if(null==i)return;"object"===o(i)&&(t=i);}else {"string"==typeof e&&(e=e.split(n));var s=e.pop(),r=function(t,e,i){var n=t;if($(e));else {var s;"string"==typeof e&&(e=e.split("."));for(var r=0,a=e.length;r<a;r++){var h;null!=n[s=e[r]]&&"object"===o(n[s])||(h=r===a-1?void 0===i?{}:i:{},n[s]=h),n=n[s];}}return n}(t,e);r[s]=i;}return t}};E.register("ninePatch",(function(t,e,i,n,s,r,o,a){var h=new q(this.scene,t,e,i,n,s,r,o,a);return this.scene.add.existing(h),h})),Q(window,"RexPlugins.UI.NinePatch",q);var tt=Phaser.GameObjects.GetCalcMatrix,et=Phaser.Renderer.Canvas.SetTransform,it={renderWebGL:function(t,e,i,n){var s=e.getRenderList();if(0!==s.length){i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),o=e.frame.glTexture,a=r.setGameObject(e),h=i.roundPixels,l=tt(e,i,n),u=r.calcMatrix.copyFrom(l.calc),c=e._displayOriginX,d=e._displayOriginY,f=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var p=0,v=s.length;p<v;p++)s[p].webglRender(r,u,f,c,d,o,a,h);t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){var s=t.currentContext,r=e.getRenderList();if(0!==r.length&&et(t,s,e,i,n)){i.addToRenderList(e);var o=i.roundPixels,a=-e._displayOriginX,h=-e._displayOriginY;s.translate(a,h);for(var l=0,u=r.length;l<u;l++)r[l].canvasRender(s,a,h,o);s.restore();}}},nt=function(t,e){if(this.width===t&&this.height===e)return this;this.width=t,this.height=e,this.updateDisplayOrigin();var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this},st=Phaser.Utils.Array.Remove,rt=function(){return this.poolManager&&this.poolManager.freeMultiple(this.children.list),this.children.list.length=0,this.lastAppendedChildren.length=0,this.dirty=!0,this},ot={setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.frame=this.texture.get(e),this},resize:nt,setSize:nt,addChild:function(t){var e;(this.lastAppendedChildren.length=0,Array.isArray(t))?(this.children.add(t),(e=this.lastAppendedChildren).push.apply(e,w(t))):(this.children.add(t),this.lastAppendedChildren.push(t));return this},removeChild:function(t){return this.poolManager&&this.poolManager.free(t),st(this.children.list,t),this.lastAppendedChildren.length=0,this.dirty=!0,this},removeChildren:rt,clear:rt,getLastAppendedChildren:function(){return this.lastAppendedChildren},getChildren:function(){return this.children.list}};Object.assign(ot,{setTint:function(t){return this.tint=t,this.tintFill=!1,this},setTintFill:function(t){return this.tint=t,this.tintFill=!0,this},clearTint:function(){return this.setTint(16777215),this}});var at=function(){function t(){h(this,t),this.items=[];}return u(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0;}},{key:"pop",value:function(){return this.items.length>0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),ht=Phaser.Utils.Objects.GetValue,lt={},ut=function(){function t(e){h(this,t),this.pools=ht(e,"pools",lt);}return u(t,[{key:"destroy",value:function(){this.pools=void 0;}},{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new at),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e<i;e++)this.free(t[e]);return this}},{key:"allocate",value:function(t){return this.pools&&this.pools.hasOwnProperty(t)?this.pools[t].pop():null}}]),t}(),ct=!1,dt=function(t){ct||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])<t&&console.error("Minimum supported version : 3.".concat(t)),ct=!0);};dt();var ft=Phaser.GameObjects.GameObject,pt=Phaser.Utils.Objects.IsPlainObject,vt=Phaser.Utils.Objects.GetValue,gt=Phaser.Structs.List,yt=Phaser.Utils.Array.StableSort,mt=function(e){function i(e,n,s,r,o,a){var l;h(this,i),pt(n)&&(n=vt(a=n,"x",0),s=vt(a,"y",0),r=vt(a,"texture"),o=vt(a,"frame")),void 0===n&&(n=0),void 0===s&&(s=0),(l=t(this,i,[e,"rexBlitter"])).children=new gt,l.renderList=[],l.displayListDirty=!1,l.lastAppendedChildren=[];var u=vt(a,"reuseBob",!0);return l.poolManager=u?new ut(a):void 0,l.setTexture(r,o),l.setPosition(n,s),l.setOrigin(0,0),l.clearTint(),l.initPipeline(),l.initPostPipeline(),l}return d(i,e),u(i,[{key:"preDestroy",value:function(){this.removeChildren(),this.children.destroy(),this.renderList.length=0,this.poolManager&&this.poolManager.destroy();}},{key:"getRenderList",value:function(){if(this.displayListDirty){this.renderList.length=0;for(var t=!1,e=this.children.list,i=0,n=e.length;i<n;i++){var s=e[i];kt(s)&&(this.renderList.push(s),t||(t=0!==s.depth));}t&&yt(this.renderList,bt),this.displayListDirty=!1;}return this.renderList}}]),i}(ft),kt=function(t){return t.active&&t.visible&&t.alpha>0},bt=function(t,e){return t._depth-e._depth},xt=Phaser.GameObjects.Components;Phaser.Class.mixin(mt,[xt.Alpha,xt.BlendMode,xt.ComputedSize,xt.Depth,xt.GetBounds,xt.Mask,xt.Origin,xt.Pipeline,xt.PostPipeline,xt.ScrollFactor,xt.Transform,xt.Visible,it,ot]);var Ct="image",wt=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1!==e.indexOf(".")){for(var n=e.split("."),s=t,r=i,o=0;o<n.length;o++){if(!s.hasOwnProperty(n[o])){r=i;break}r=s[n[o]],s=s[n[o]];}return r}return i}return i},St=function(t){if("object"!==o(t)||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},Pt={enableData:function(){return void 0===this.data&&(this.data={}),this},setData:function(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t];}else this.data[t]=e;return this},getData:function(t,e){return this.enableData(),void 0===t?this.data:wt(this.data,t,e)},incData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData:function(){return this.data&&St(this.data),this}},Tt=function(){function t(e,i){h(this,t),this.type=i,this.data=void 0,this.setParent(e).reset().setActive();}return u(t,[{key:"destroy",value:function(){this.parent&&this.parent.removeChild(this);}},{key:"setParent",value:function(t){return this.parent=t,this}},{key:"setDisplayListDirty",value:function(t){return t&&this.parent&&(this.parent.displayListDirty=!0),this}},{key:"active",get:function(){return this._active},set:function(t){this.setDisplayListDirty(this._active!=t),this._active=t;}},{key:"setActive",value:function(t){return void 0===t&&(t=!0),this.active=t,this}},{key:"modifyPorperties",value:function(t){return this}},{key:"reset",value:function(){this.clearData();}},{key:"onFree",value:function(){this.reset().setActive(!1).setParent();}}]),t}();
/**
   * @author       Richard Davey <rich@photonstorm.com>
   * @copyright    2019 Photon Storm Ltd.
   * @license      {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
   */Object.assign(Tt.prototype,Pt);var Ot=Phaser.Math.DegToRad,Mt=Phaser.Math.RadToDeg,Et=Phaser.Utils.Objects.GetValue,_t=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDisplayListDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDisplayListDirty(!!this._alpha!=!!t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"setX",value:function(t){return this.x=t,this}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return Mt(this.rotation)},set:function(t){this.rotation=Ot(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return this._width},set:function(t){this._width=t;}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"height",get:function(){return this._height},set:function(t){this._height=t;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"displayWidth",get:function(){return this._width*this.scaleX},set:function(t){this.scaleX=t/this._width;}},{key:"setDisplayWidth",value:function(t,e){return void 0===e&&(e=!1),this.displayWidth=t,e&&(this.scaleY=this.scaleX),this}},{key:"displayHeight",get:function(){return this._height*this.scaleY},set:function(t){this.scaleY=t/this._height;}},{key:"setDisplayHeight",value:function(t,e){return void 0===e&&(e=!1),this.displayHeight=t,e&&(this.scaleX=this.scaleY),this}},{key:"setOriginX",value:function(t){return this.originX=t,this._displayOriginX=this.width*t,this}},{key:"setOriginY",value:function(t){return this.originY=t,this._displayOriginY=this.height*t,this}},{key:"setOrigin",value:function(t,e){return void 0===e&&(e=t),this.setOriginX(t).setOriginY(e),this}},{key:"depth",get:function(){return this._depth},set:function(t){this.setDisplayListDirty(this._depth!=t),this._depth=t;}},{key:"setDepth",value:function(t){return void 0===t&&(t=0),this.depth=t,this}},{key:"modifyPorperties",value:function(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Et(t,"width",void 0),i=Et(t,"height",void 0),n=Et(t,"scale",void 0),s=Et(t,"scaleX",n),r=Et(t,"scaleY",n);void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s?this.setScaleX(s):t.hasOwnProperty("displayWidth")&&this.setDisplayWidth(t.displayWidth),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r?this.setScaleY(r):t.hasOwnProperty("displayHeight")&&this.setDisplayHeight(t.displayHeight);var o=Et(t,"origin",void 0);return void 0!==o?this.setOrigin(o):(t.hasOwnProperty("originX")&&this.setOriginX(t.originX),t.hasOwnProperty("originY")&&this.setOriginY(t.originY)),t.hasOwnProperty("depth")&&this.setDepth(t.depth),this}},{key:"reset",value:function(){return m(f(i.prototype),"reset",this).call(this),this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setOrigin(0).setDepth(0),this}},{key:"webglRender",value:function(t,e,i,n,s,r,o,a){}},{key:"canvasRender",value:function(t,e,i,n){}}]),i}(Tt),Rt=Phaser.GameObjects.Components.TransformMatrix,Lt=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha,Bt=new Rt,Dt=Phaser.Utils.Objects.IsPlainObject,It=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,Ct])).setFrame(n),s}return d(i,e),u(i,[{key:"width",get:function(){return this._width},set:function(t){}},{key:"height",get:function(){return this._height},set:function(t){}},{key:"setFrame",value:function(t){return arguments.length>0&&!Dt(t)&&(t=this.parent.texture.get(t)),this.frame=t,this._width=t?t.width:0,this._height=t?t.height:0,this}},{key:"setFlipX",value:function(t){return void 0===t&&(t=!0),this.flipX=t,this}},{key:"setFlipY",value:function(t){return void 0===t&&(t=!0),this.flipY=t,this}},{key:"resetFlip",value:function(){return this.flipX=!1,this.flipY=!1,this}},{key:"tint",get:function(){return void 0===this._tint?this.parent.tint:this._tint},set:function(t){this._tint=t;}},{key:"setTint",value:function(t){return this.tint=t,this.tintFill=!1,this}},{key:"setTintFill",value:function(t){return this.tint=t,this.tintFill=!0,this}},{key:"clearTint",value:function(){return this.setTint(16777215),this}},{key:"resetTint",value:function(){return this.tint=void 0,this.tintFill=void 0,this}},{key:"tintFill",get:function(){return void 0===this._tintFill?this.parent.tintFill:this._tintFill},set:function(t){this._tintFill=t;}},{key:"reset",value:function(){return m(f(i.prototype),"reset",this).call(this),this.resetFlip().resetTint().setFrame(),this}},{key:"modifyPorperties",value:function(t){return t?(t.hasOwnProperty("width")&&(t.displayWidth=t.width,delete t.width),t.hasOwnProperty("height")&&(t.displayHeight=t.height,delete t.height),t.hasOwnProperty("frame")&&this.setFrame(t.frame),m(f(i.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("flipX")&&this.setFlipX(t.flipX),t.hasOwnProperty("flipY")&&this.setFlipY(t.flipY),t.hasOwnProperty("tint")&&this.setTint(t.tint),t.hasOwnProperty("tintFill")&&this.setTintFill(t.tintFill),this):this}}]),i}(_t),jt={webglRender:function(t,e,i,n,s,r,o,a){var h=this._width,l=this._height,u=h*this.originX,c=l*this.originY,d=this.x-n,f=this.y-s,p=1,v=1;this.flipX&&(d+=h-2*u,p=-1),this.flipY&&(f+=l-2*c,v=-1),Bt.applyITRS(d,f,this.rotation,this.scaleX*p,this.scaleY*v),e.multiply(Bt,Bt);var g=-u,y=-c,m=g+h,k=y+l,b=Bt.setQuad(g,y,m,k,a),x=this.frame.u0,C=this.frame.v0,w=this.frame.u1,S=this.frame.v1,P=Lt(this.tint,this.alpha*i);t.batchQuad(this.parent,b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],x,C,w,S,P,P,P,P,this.tintFill,r,o);},canvasRender:function(t,e,i,n){t.save();var s=this._width,r=this._height,o=s*this.originX,a=r*this.originY,h=this.x-o,l=this.y-a,u=1,c=1;this.flipX&&(h+=s,u=-1),this.flipY&&(l+=r,c=-1),n&&(h=Math.round(h),l=Math.round(l)),t.translate(h,l),t.rotate(this.rotation),t.scale(this.scaleX*u,this.scaleY*c);var d=this.frame;t.drawImage(d.source.image,d.cutX,d.cutY,s,r,0,0,s,r),t.restore();}};Object.assign(It.prototype,jt);var zt=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(Ct):null;return null===i?i=new It(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},At={_drawImage:function(t,e,i,n,s,r){zt(this,{frame:e,x:i,y:n,width:s,height:r});},_drawTileSprite:function(t,e,i,n,s,r){var o=this.texture.get(e),a=o.width,h=o.height,l=Math.floor(s/a),u=Math.floor(r/h);i+=(s-l*a)/2,n+=(r-u*h)/2;for(var c=0;c<l;c++)for(var d=0;d<u;d++)zt(this,{frame:e,x:i+c*a,y:n+d*h});}},Ft=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"setBaseTexture",value:function(t,e,n,s){return this.setTexture(t,e),m(f(i.prototype),"setBaseTexture",this).call(this,t,e,n,s),this}}]),i}(V(mt,"rexNinePatch2"));Object.assign(Ft.prototype,At),E.register("ninePatch2",(function(t,e,i,n,s,r,o,a){var h=new Ft(this.scene,t,e,i,n,s,r,o,a);return this.scene.add.existing(h),h})),Q(window,"RexPlugins.UI.NinePatch2",Ft);var Wt=Phaser.Utils.Objects.GetValue,Vt=function(){function t(e,i,n,s,r){h(this,t),void 0===e&&(e=0),void 0===i&&(i=e),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(e,i,n,s,r);}return u(t,[{key:"setTo",value:function(t,e,i,n,s){return this.setPosition(t,e),this.setRadius(s),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)},set:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Wt(t,"x",0),i=Wt(t,"y",0));var n=this.cornerRadius;n.tl=Yt(Wt(t,"tl",void 0),e,i),n.tr=Yt(Wt(t,"tr",void 0),e,i),n.bl=Yt(Wt(t,"bl",void 0),e,i),n.br=Yt(Wt(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){Gt(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){Gt(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){Gt(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){Gt(this.cornerRadius.br,t);}}]),t}(),Yt=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xt(t),t},Gt=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Wt(e,"x",0),t.y=Wt(e,"y",0)),Xt(t);},Xt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},Ht=function(t,e,i){var n=i.length;if(n>=2){var s=i[n-2],r=i[n-1];if(t===s&&e===r)return i}return i.push(t,e),i},Ut=Phaser.Math.DegToRad,Nt=function(t,e,i,n,s,r,o,a,h){o&&r>s?r-=360:!o&&r<s&&(r+=360);var l=Ut(r-s)/a;s=Ut(s);for(var u=0;u<=a;u++){var c=s+l*u,d=t+i*Math.cos(c),f=e+n*Math.sin(c);Ht(d,f,h);}return h},Kt=Phaser.Renderer.WebGL.Utils,Jt=function(t,e,i,n,s,r){for(var o=Kt.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*n),a=i.pathData,h=i.pathIndexes,l=0;l<h.length;l+=3){var u=2*h[l],c=2*h[l+1],d=2*h[l+2],f=a[u+0]-s,p=a[u+1]-r,v=a[c+0]-s,g=a[c+1]-r,y=a[d+0]-s,m=a[d+1]-r,k=e.getX(f,p),b=e.getY(f,p),x=e.getX(v,g),C=e.getY(v,g),w=e.getX(y,m),S=e.getY(y,m);t.batchTri(i,k,b,x,C,w,S,0,0,1,1,o,o,o,2);}},qt=Phaser.Renderer.WebGL.Utils,Zt=function(t,e,i,n,s){var r=t.strokeTint,o=qt.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*i);r.TL=o,r.TR=o,r.BL=o,r.BR=o;var a=e.pathData,h=a.length-1,l=e.lineWidth,u=l/2,c=a[0]-n,d=a[1]-s;e.closePath||(h-=2);for(var f=2;f<h;f+=2){var p=a[f]-n,v=a[f+1]-s;t.batchLine(c,d,p,v,u,u,l,f-2,!!e.closePath&&f===h-1),c=p,d=v;}},$t=Phaser.GameObjects.GetCalcMatrix,Qt=function(t,e,i,n){var s=i||e.fillColor,r=n||e.fillAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.fillStyle="rgba("+o+","+a+","+h+","+r+")";},te=function(t,e,i,n){var s=i||e.strokeColor,r=n||e.strokeAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.strokeStyle="rgba("+o+","+a+","+h+","+r+")",t.lineWidth=e.lineWidth;},ee=Phaser.Renderer.Canvas.SetTransform,ie={renderWebGL:function(t,e,i,n){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var s=t.pipelines.set(e.pipeline),r=$t(e,i,n),o=s.calcMatrix.copyFrom(r.calc),a=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Jt(s,o,e,l,a,h),e.isStroked&&Zt(s,e,l,a,h),t.pipelines.postBatch(e);},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var s=t.currentContext;if(ee(t,s,e,i,n)){var r=e._displayOriginX,o=e._displayOriginY,a=e.pathData,h=a.length-1,l=a[0]-r,u=a[1]-o;s.beginPath(),s.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c<h;c+=2){var d=a[c]-r,f=a[c+1]-o;s.lineTo(d,f);}s.closePath(),e.isFilled&&(Qt(s,e),s.fill()),e.isStroked&&(te(s,e),s.stroke()),s.restore();}}},ne=Phaser.GameObjects.Shape,se=Phaser.Utils.Objects.IsPlainObject,re=Phaser.Utils.Objects.GetValue,oe=Phaser.Geom.Polygon.Earcut,ae=function(e){function i(e,n,s,r,o,a,l,u){var c,d,f,p,v;if(h(this,i),se(n)){var g=n;n=g.x,s=g.y,r=g.width,o=g.height,a=g.radius,l=g.color,u=g.alpha,d=g.strokeColor,f=g.strokeAlpha,p=g.strokeWidth,v=g.shape;}void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=1),void 0===o&&(o=r),void 0===a&&(a=0),void 0===v&&(v=0);var y=new Vt;if((c=t(this,i,[e,"rexRoundRectangleShape",y])).setShapeType(v),0===c.shapeType){var m=re(a,"radius",a);y.setTo(0,0,r,o,m);}else {m={x:r/2,y:o/2};y.setTo(0,0,r,o,m);}var k=re(a,"iteration",void 0);return c.setIteration(k),c.setPosition(n,s),c.setFillStyle(l,u),void 0!==d&&void 0===p&&(p=2),c.setStrokeStyle(p,d,f),c.updateDisplayOrigin(),c.dirty=!0,c}return d(i,e),u(i,[{key:"fillColor",get:function(){return this._fillColor},set:function(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,s=t.height,r=t.cornerRadius,o=this.iteration+1;if(i=r.tl,he(i))if(i.convex){var a=i.x,h=i.y;Nt(a,h,i.x,i.y,180,270,!1,o,e);}else {Nt(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else Ht(0,0,e);if(i=r.tr,he(i))if(i.convex){a=n-i.x,h=i.y;Nt(a,h,i.x,i.y,270,360,!1,o,e);}else {Nt(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else Ht(n,0,e);if(i=r.br,he(i))if(i.convex){a=n-i.x,h=s-i.y;Nt(a,h,i.x,i.y,0,90,!1,o,e);}else {Nt(a=n,h=s,i.x,i.y,270,180,!0,o,e);}else Ht(n,s,e);if(i=r.bl,he(i))if(i.convex){a=i.x,h=s-i.y;Nt(a,h,i.x,i.y,90,180,!1,o,e);}else {Nt(a=0,h=s,i.x,i.y,360,270,!0,o,e);}else Ht(0,s,e);return e.push(e[0],e[1]),this.pathIndexes=oe(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=le[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),i}(ne),he=function(t){return t.x>0&&t.y>0},le={rectangle:0,circle:1};Object.assign(ae.prototype,ie),E.register("roundRectangle",(function(t,e,i,n,s,r,o){var a=new ae(this.scene,t,e,i,n,s,r,o);return this.scene.add.existing(a),a})),Q(window,"RexPlugins.UI.RoundRectangle",ae);var ue=Phaser.Renderer.WebGL.Utils,ce={renderWebGL:function(t,e,i,n){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var s=e.frame,r=s.width,o=s.height,a=ue.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(s.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,s.glTexture,r,o,e.x,e.y,r/e.resolution,o/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,r,o,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},de=Phaser.Display.Color,fe={clear:function(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill:function(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r,o,a,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=c),void 0===r&&(r=d),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=c),void 0===l&&(l=d);var f=u.cutX+o,p=u.cutY+a;return this.context.drawImage(u.source.image,f,p,h,l,i,n,s,r),this.dirty=!0,this},getDataURL:function(t,e){return this.canvas.toDataURL(t,e)},getPixel:function(t,e,i){void 0===i&&(i=new de);var n=this.context.getImageData(t,e,1,1);return i.setTo(n.data[0],n.data[1],n.data[2],n.data[3]),i},setPixel:function(t,e,i,n,s,r){if("number"!=typeof i){var o=i;i=o.red,n=o.green,s=o.blue,r=o.alpha;}void 0===r&&(r=0!==i||0!==n||0!==s?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=n,a.data[2]=s,a.data[3]=r,this.context.putImageData(a,t,e),this.dirty=!0,this}},pe=function(t,e,i,n,s,r,o){var a,h=t.sys.textures,l=t.renderer;void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=e.width),void 0===o&&(o=e.height);var u=(a=h.exists(i)?h.get(i):h.createCanvas(i,r,o)).getSourceImage();u.width!==r&&(u.width=r),u.height!==o&&(u.height=o);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,r,o),c.drawImage(e,n,s,r,o),l.gl&&a&&l.canvasToTexture(u,a.source[0].glTexture,!0,0);},ve={updateTexture:function(t,e){t&&(e?t.call(e,this.canvas,this.context):t(this.canvas,this.context)),this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),("undefined"==typeof WEBGL_DEBUG||o(WEBGL_DEBUG))&&(this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"})),this.dirty=!1;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=this.width,i.hitArea.height=this.height),this},generateTexture:function(t,e,i,n,s){var r=this.canvas;return void 0===n?n=r.width:n*=this.resolution,void 0===s?s=r.height:s*=this.resolution,pe(this.scene,r,t,e,i,n,s),this},loadTexture:function(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};dt();var ge=Phaser.Display.Canvas.CanvasPool,ye=Phaser.GameObjects.GameObject,me=Phaser.Utils.String.UUID,ke=function(e){function i(e,n,s,r,o){var a;return h(this,i),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=1),void 0===o&&(o=1),(a=t(this,i,[e,"rexCanvas"])).renderer=e.sys.game.renderer,a.resolution=1,a._width=r,a._height=o,r=Math.max(Math.ceil(r*a.resolution),1),o=Math.max(Math.ceil(o*a.resolution),1),a.canvas=ge.create(v(a),r,o),a.context=a.canvas.getContext("2d",{willReadFrequently:!0}),a.dirty=!1,a.setPosition(n,s),a.setOrigin(.5,.5),a.initPipeline(),a.initPostPipeline(!0),a._crop=a.resetCropObject(),a._textureKey=me(),a.texture=e.sys.textures.addCanvas(a._textureKey,a.canvas),a.frame=a.texture.get(),a.frame.source.resolution=a.resolution,a.renderer&&a.renderer.gl&&(a.renderer.deleteTexture(a.frame.source.glTexture),a.frame.source.glTexture=null),a.dirty=!0,a}return d(i,e),u(i,[{key:"preDestroy",value:function(){ge.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy();}},{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height);}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t);}},{key:"setCanvasSize",value:function(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}},{key:"setSize",value:function(t,e){return this.setCanvasSize(t,e),this}},{key:"displayWidth",get:function(){return this.scaleX*this._width},set:function(t){this.scaleX=t/this._width;}},{key:"displayHeight",get:function(){return this.scaleY*this._height},set:function(t){this.scaleY=t/this._height;}},{key:"setDisplaySize",value:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}},{key:"getCanvas",value:function(t){return t||(this.dirty=!0),this.canvas}},{key:"getContext",value:function(t){return t||(this.dirty=!0),this.context}},{key:"needRedraw",value:function(){return this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}}]),i}(ye),be=Phaser.GameObjects.Components;Phaser.Class.mixin(ke,[be.Alpha,be.BlendMode,be.Crop,be.Depth,be.Flip,be.GetBounds,be.Mask,be.Origin,be.Pipeline,be.PostPipeline,be.ScrollFactor,be.Tint,be.Transform,be.Visible,ce,fe,ve]);var xe=Phaser.Utils.String.Pad,Ce=function(t,e,i){if(null==t)return t;switch(o(t)){case"string":default:return t;case"number":return "#".concat(xe(Math.floor(t).toString(16),6,"0",1));case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?"rgba(".concat(t.r,",").concat(t.g,",").concat(t.b,",").concat(t.a,")"):"rgb(".concat(t.r,",").concat(t.g,",").concat(t.b,")"):t.hasOwnProperty("h")?t.hasOwnProperty("a")?"hsla(".concat(t.h,",").concat(t.s,",").concat(t.l,",").concat(t.a,")"):"hsl(".concat(t.h,",").concat(t.s,",").concat(t.l,")"):t}},we=Phaser.Math.DegToRad,Se=function(t,e,i,n,s,r,o){var a,h,l,u,c,d=new Vt(e,i,n,s,r),f=d.minWidth,p=d.minHeight,v=n>=f?1:n/f,g=s>=p?1:s/p,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,Te(a)?(h=a.x*v,l=a.y*g,Pe(a)?Oe(t,h,l,h,l,180,270,!1,o):Oe(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,Te(a)?(h=a.x*v,l=a.y*g,Pe(a)?Oe(t,n-h,l,h,l,270,360,!1,o):Oe(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,Te(a)?(h=a.x*v,l=a.y*g,Pe(a)?Oe(t,n-h,s-l,h,l,0,90,!1,o):Oe(t,n,s,h,l,270,180,!0,o)):t.lineTo(n,s),a=y.bl,Te(a)?(h=a.x*v,l=a.y*g,Pe(a)?Oe(t,h,s-l,h,l,90,180,!1,o):Oe(t,0,s,h,l,360,270,!0,o)):t.lineTo(0,s),t.lineTo(u,c),t.closePath(),t.restore();},Pe=function(t){return !t.hasOwnProperty("convex")||t.convex},Te=function(t){return t.x>0&&t.y>0},Oe=function(t,e,i,n,s,r,o,a,h){if(a&&o>r?o-=360:!a&&o<r&&(o+=360),r=we(r),o=we(o),null==h)t.ellipse(e,i,n,s,0,r,o,a);else for(var l,u,c,d=(o-r)/(h+=1),f=0;f<=h;f++)c=r+d*f,l=e+n*Math.cos(c),u=i+s*Math.sin(c),t.lineTo(l,u);},Me=function(t,e,i,n,s,r,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h=Math.max(1,h-n),l=Math.max(1,l-n),function(t,e,i,n,s,r,o,a,h,l,u,c,d){if(Se(e,i,n,s,r,o,d),null!=a){var f;null!=u&&((f=c?e.createLinearGradient(0,0,s,0):e.createLinearGradient(0,0,0,r)).addColorStop(0,a),f.addColorStop(1,u),a=f),e.fillStyle=a,e.fill();}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());}(t.canvas,t.context,u,u,h,l,s,e,i,n,r,o,a);}},Ee=function(){Me(this,this.fillStyle,this.strokeStyle,this.lineWidth,this.radius,this.fillColor2,this.isHorizontalGradient,this.iteration);},_e=Phaser.Utils.Objects.GetValue,Re=function(e){function i(e,n,s,r,o,a,l,u,c,d,f){var p;h(this,i),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=1),void 0===o&&(o=r),void 0===a&&(a=0),(p=t(this,i,[e,n,s,r,o])).type="rexRoundRectangleCanvas";var v=_e(a,"radius",a),g=_e(a,"iteration",void 0);return p.setRadius(v),p.setIteration(g),p.setFillStyle(l,d,f),p.setStrokeStyle(u,c),p}return d(i,e),u(i,[{key:"radius",get:function(){return this._radius},set:function(t){this.dirty|=this._radius!=t,this._radius=t;}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"iteration",get:function(){return this._iteration},set:function(t){this.dirty|=this._iteration!=t,this._iteration=t;}},{key:"setIteration",value:function(t){return this.iteration=t,this}},{key:"fillStyle",get:function(){return this._fillStyle},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty|=this._fillStyle!=t,this._fillStyle=t;}},{key:"fillColor2",get:function(){return this._fillColor2},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty|=this._fillColor2!=t,this._fillColor2=t;}},{key:"isHorizontalGradient",get:function(){return this._isHorizontalGradient},set:function(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t;}},{key:"setFillStyle",value:function(t,e,i){return void 0===i&&(i=!0),this.fillStyle=t,this.fillColor2=e,this.isHorizontalGradient=i,this}},{key:"strokeStyle",get:function(){return this._strokeStyle},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty|=this._strokeStyle!=t,this._strokeStyle=t;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this.dirty|=this._lineWidth!=t,this._lineWidth=t;}},{key:"setStrokeStyle",value:function(t,e){return this.strokeStyle=t,this.lineWidth=e,this}},{key:"updateTexture",value:function(){return this.clear(),Ee.call(this),m(f(i.prototype),"updateTexture",this).call(this),this}}]),i}(ke);E.register("roundRectangleCanvas",(function(t,e,i,n,s,r,o,a,h,l){var u=new Re(this.scene,t,e,i,n,s,r,o,a,h,l);return this.scene.add.existing(u),u})),Q(window,"RexPlugins.UI.RoundRectangleCanvas",Re);
/**
   * @author       Richard Davey <rich@photonstorm.com>
   * @copyright    2019 Photon Storm Ltd.
   * @license      {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
   */
var Le=Phaser.Renderer.WebGL.Utils,Be={renderWebGL:function(t,e,i,n){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var s=e.frame,r=s.width,o=s.height,a=Le.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(s.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,s.glTexture,r,o,e.x,e.y,r/e.style.resolution,o/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,r,o,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},De=Phaser.Display.Canvas.CanvasPool;dt();var Ie=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"setStyle",value:function(t){return this.style.setStyle(t)}},{key:"setFont",value:function(t){return this.style.setFont(t)}},{key:"setFontFamily",value:function(t){return this.style.setFontFamily(t)}},{key:"setFontSize",value:function(t){return this.style.setFontSize(t)}},{key:"setFontStyle",value:function(t){return this.style.setFontStyle(t)}},{key:"setTestString",value:function(t){return this.style.setTestString(t)}},{key:"setFixedSize",value:function(t,e){return this.style.setFixedSize(t,e)}},{key:"setBackgroundColor",value:function(t,e,i){return this.style.setBackgroundColor(t,e,i)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.style.setBackgroundStrokeColor(t,e)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.style.setBackgroundCornerRadius(t,e)}},{key:"setFill",value:function(t){return this.style.setFill(t)}},{key:"setColor",value:function(t){return this.style.setColor(t)}},{key:"setStroke",value:function(t,e){return this.style.setStroke(t,e)}},{key:"setShadow",value:function(t,e,i,n,s,r){return this.style.setShadow(t,e,i,n,s,r)}},{key:"setShadowOffset",value:function(t,e){return this.style.setShadowOffset(t,e)}},{key:"setShadowColor",value:function(t){return this.style.setShadowColor(t)}},{key:"setShadowBlur",value:function(t){return this.style.setShadowBlur(t)}},{key:"setShadowStroke",value:function(t){return this.style.setShadowStroke(t)}},{key:"setShadowFill",value:function(t){return this.style.setShadowFill(t)}},{key:"setWrapMode",value:function(t){return this.style.setWrapMode(t)}},{key:"setWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setWordWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setHAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setVAlign",value:function(t){return this.style.setVAlign(t)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.updateText(!1),this}},{key:"setXOffset",value:function(t){return this.style.setXOffset(t)}},{key:"setMaxLines",value:function(t){return this.style.setMaxLines(t)}},{key:"setResolution",value:function(t){return this.style.setResolution(t)}},{key:"getTextMetrics",value:function(){return this.style.getTextMetrics()}},{key:"setTextMetrics",value:function(t,e){return this.style.setTextMetrics(t,e)}},{key:"measureTextMargins",value:function(t,e){return function(t,e,i){void 0===i&&(i={});var n=De.create(this),s=n.getContext("2d",{willReadFrequently:!0});t.syncFont(n,s);var r=s.measureText(e),o=Math.ceil(r.width*t.baselineX),a=o,h=2*a;if(a=a*t.baselineY|0,n.width=o,n.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=t._font,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(t.testString,0,a),i.left=0,0===o||0===h||!s.getImageData(0,0,o,h))return De.remove(n),i;for(var l=s.getImageData(0,0,o,h).data,u=!1,c=0;c<o;c++){for(var d=0;d<h;d++)if(255!==l[4*(d*o+c)]){i.left=c,u=!0;break}if(u)break}return De.remove(n),i}(this.style,t,e)}}]),i}(Phaser.GameObjects.GameObject),je=Phaser.GameObjects.Components;Phaser.Class.mixin(Ie,[je.Alpha,je.BlendMode,je.ComputedSize,je.Crop,je.Depth,je.Flip,je.GetBounds,je.Mask,je.Origin,je.Pipeline,je.PostPipeline,je.ScrollFactor,je.Tint,je.Transform,je.Visible,Be]);var ze={backgroundColor:["backgroundColor",null,Ce],backgroundColor2:["backgroundColor2",null,Ce],backgroundHorizontalGradient:["backgroundHorizontalGradient",!0,null],backgroundStrokeColor:["backgroundStrokeColor",null,Ce],backgroundStrokeLineWidth:["backgroundStrokeLineWidth",2,null],backgroundCornerRadius:["backgroundCornerRadius",0,null],backgroundCornerIteration:["backgroundCornerIteration",null,null],fontFamily:["fontFamily","Courier",null],fontSize:["fontSize","16px",null],fontStyle:["fontStyle","",null],color:["color","#fff",Ce],stroke:["stroke","#fff",Ce],strokeThickness:["strokeThickness",0,null],shadowOffsetX:["shadow.offsetX",0,null],shadowOffsetY:["shadow.offsetY",0,null],shadowColor:["shadow.color","#000",Ce],shadowBlur:["shadow.blur",0,null],shadowStroke:["shadow.stroke",!1,null],shadowFill:["shadow.fill",!1,null],underlineColor:["underline.color","#000",Ce],underlineThickness:["underline.thickness",0,null],underlineOffset:["underline.offset",0,null],strikethroughColor:["strikethrough.color","#000",Ce],strikethroughThickness:["strikethrough.thickness",0,null],strikethroughOffset:["strikethrough.offset",0,null],halign:["halign","left",null],valign:["valign","top",null],maxLines:["maxLines",0,null],fixedWidth:["fixedWidth",0,null],fixedHeight:["fixedHeight",0,null],resolution:["resolution",0,null],lineSpacing:["lineSpacing",0,null],xOffset:["xOffset",0,null],rtl:["rtl",!1,null],testString:["testString","|MÃ‰qgy",null],baselineX:["baselineX",1.2,null],baselineY:["baselineY",1.4,null],wrapMode:["wrap.mode",0,null],wrapWidth:["wrap.width",0,null],wrapCallback:["wrap.callback",null],wrapCallbackScope:["wrap.callbackScope",null]},Ae=Phaser.Display.Canvas.CanvasPool,Fe=function(t){var e=Ae.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var n=i.measureText(t.testString);if("actualBoundingBoxAscent"in n){var s=n.actualBoundingBoxAscent,r=n.actualBoundingBoxDescent,o={ascent:s,descent:r,fontSize:s+r};return Ae.remove(e),o}var a=Math.ceil(n.width*t.baselineX),h=a,l=2*h;h=h*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h);o={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,a,l))return o.ascent=h,o.descent=h+6,o.fontSize=o.ascent+o.descent,Ae.remove(e),o;var u,c,d=i.getImageData(0,0,a,l).data,f=d.length,p=4*a,v=0,g=!1;for(u=0;u<h;u++){for(c=0;c<p;c+=4)if(255!==d[v+c]){g=!0;break}if(g)break;v+=p;}for(o.ascent=h-u,v=f-p,g=!1,u=l;u>h;u--){for(c=0;c<p;c+=4)if(255!==d[v+c]){g=!0;break}if(g)break;v-=p;}return o.descent=u-h,o.fontSize=o.ascent+o.descent,Ae.remove(e),o},We=0,Ve=1,Ye=2,Ge=0,Xe=1,He=2,Ue=3,Ne=/(?:\r\n|\r|\n)/,Ke=Phaser.Utils.Objects.GetAdvancedValue,Je=Phaser.Utils.Objects.GetValue,qe=function(){function t(e,i,n){h(this,t),this.parent=e,void 0===n&&(n=ze),this.propertyMap=n,this.backgroundColor,this.backgroundColor2,this.backgroundHorizontalGradient,this.backgroundStrokeColor,this.backgroundStrokeLineWidth,this.backgroundCornerRadius,this.backgroundCornerIteration,this.fontFamily,this.fontSize,this.fontStyle,this.color,this.stroke,this.strokeThickness,this.shadowOffsetX,this.shadowOffsetY,this.shadowColor,this.shadowBlur,this.shadowStroke,this.shadowFill,this.underlineColor,this.underlineThickness,this.underlineOffset,this.strikethroughColor,this.strikethroughThickness,this.strikethroughOffset,this.halign,this.valign,this.maxLines,this.fixedWidth,this.fixedHeight,this.resolution,this.xOffset,this.rtl,this.testString,this.baselineX,this.baselineY,this.wrapMode,this.wrapWidth,this.wrapCallback,this.wrapCallbackScope,this._font,this.setStyle(i,!1,!0);}return u(t,[{key:"isWrapFitMode",get:function(){return this.fixedWidth>0&&this.wrapMode!==Ge&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var n=t.wordWrap;n.hasOwnProperty("width")&&(t.wrap={mode:"word",width:n.width});}if(t&&t.hasOwnProperty("wrap")){var s=t.wrap;if(s.hasOwnProperty("mode")){var r=s.mode;"string"==typeof r&&(s.mode=Ze[r]);}else s.hasOwnProperty("width")&&(s.mode=1);}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var o=this.propertyMap;for(var a in o){var h=o[a],l=h[0],u=i?h[1]:this[a],c=h[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Je(t,l,u);else {var d=Ke(t,l,u);c&&(d=c(d)),this[a]=d;}}var f=Je(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var p=Je(t,"fill",null);null!==p&&(this.color=Ce(p));var v=Je(t,"metrics",!1);return v?this.metrics={ascent:Je(v,"ascent",0),descent:Je(v,"descent",0),fontSize:Je(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Fe(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=Fe(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Je(t,"fontFamily","Courier"),this.fontSize=Je(t,"fontSize","16px"),this.fontStyle=Je(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Ce(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Ce(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=Ce(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=Ce(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=Ce(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Ce(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===s&&(s=!1),void 0===r&&(r=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Ce(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=s,this.shadowFill=r,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=Ce(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Ce(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=Ce(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Ce(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=Ce(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=Ze[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Je(e,"fontFamily",this.fontFamily),this.fontSize=Je(e,"fontSize",this.fontSize),this.fontStyle=Je(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.parent.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),Ze={none:Ge,word:Xe,char:He,character:He,mix:Ue},$e={draw:function(t,e,i,n){var s=this.penManager;this.hitAreaManager.clear();var r=this.context;r.save();var o=this.defaultStyle;this.clear(),Me(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,p=o.valign,v=o.lineHeight,g=s.lines,y=g.length,m=o.maxLines;m>0&&y>m?(h=m,l="center"===p?Math.floor((y-h)/2):"bottom"===p?y-h:0):(h=y,l=0),u=l+h;var k=this.rtl,b=k?this.parent.width:void 0;d="center"===p?Math.max((n-h*v)/2,0):"bottom"===p?Math.max(n-h*v-2,0):0,d+=e;for(var x=l;x<u;x++)if(0!==(a=s.getLineWidth(x))){for(var C=g[x],w=C.length,S=f,P=0;P<w;P++){var T=C[P].prop.align;if(void 0!==T){S=T;break}}c="center"===S?(i-a)/2:"right"===S?k?0:i-a:k?i-a:0,c+=t;for(P=0;P<w;P++)this.drawPen(C[P],c,d,b);}r.restore();},drawPen:function(t,e,i,n){e+=t.x,i+=t.y+(t.prop.y||0),void 0!==n&&(e=n-e);var s=this.canvas,r=this.context;r.save();var o=this.parser.propToContextStyle(this.defaultStyle,t.prop);if(o.buildFont(),o.syncFont(s,r),o.syncStyle(s,r),o.underlineThickness>0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor,o);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor,o);}if(r.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,s,r){this.autoRound&&(t=Math.round(t),e=Math.round(e));var o=this.context;r.syncShadow(o,r.shadowStroke);var a=o.lineCap;o.lineCap="butt",o.strokeStyle=s,o.lineWidth=n,o.beginPath(),o.moveTo(t,e),o.lineTo(t+i,e),o.stroke(),o.lineCap=a;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(s,n.shadowStroke),s.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(s,n.shadowFill),s.fillText(i,t,e));},drawImage:function(t,e,i,n,s){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,n,this.autoRound);}},Qe=Phaser.Utils.Objects.GetValue,ti=We,ei=Ve,ii=function(){function t(e){h(this,t),this.prop={},this.resetFromJSON(e);}return u(t,[{key:"resetFromJSON",value:function(t){this.text=Qe(t,"text",""),this.x=Qe(t,"x",0),this.y=Qe(t,"y",0),this.width=Qe(t,"width",0);var e=Qe(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Qe(t,"newLineMode",0),this.startIndex=Qe(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===ei&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==ti&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===ei&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),ni=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:St(e),i){e.length=t.length;for(var n=0,s=t.length;n<s;n++)e[n]=t[n];}else for(var r in t)e[r]=t[r];return e},si=Phaser.Utils.Objects.GetFastValue,ri=We,oi=Ye,ai=function(){function t(e){h(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=e.pensPool,this.linesPool=e.linesPool,this.tagToText=si(e,"tagToText",z),this.tagToTextScope=si(e,"tagToTextScope",void 0);}return u(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){for(var t=0,e=this.lines.length;t<e;t++)this.lines[t].length=0;this.pensPool.pushMultiple(this.pens),this.linesPool.pushMultiple(this.lines),this.maxLinesWidth=void 0;}},{key:"addTextPen",value:function(t,e,i,n,s,r){var o=this.pensPool.pop();return null==o&&(o=new ii),hi.text=t,hi.x=e,hi.y=i,hi.width=n,hi.prop=s,hi.newLineMode=r,o.resetFromJSON(hi),this.addPen(o),this}},{key:"addImagePen",value:function(t,e,i,n){return this.addTextPen("",t,e,i,n,ri),this}},{key:"addNewLinePen",value:function(){var t=this.lastPen,e=t?t.lastX:0,i=t?t.y:0,n=t?ni(t.prop):null;return this.addTextPen("",e,i,0,n,oi),this}},{key:"addPen",value:function(t){var e=this.lastPen;t.startIndex=null==e?0:e.endIndex,this.pens.push(t);var i=this.lastLine;null==i&&(i=this.linesPool.pop()||[],this.lines.push(i)),i.push(t),t.newLineMode!==ri&&(i=this.linesPool.pop()||[],this.lines.push(i)),this.maxLinesWidth=void 0;}},{key:"clone",value:function(e){null==e&&(e=new t),e.clear();for(var i=0,n=this.lines.length;i<n;i++)for(var s=this.lines[i],r=0,o=s.length;r<o;r++){var a=s[r];e.addPen(a.text,a.x,a.y,a.width,ni(a.prop),a.newLineMode);}return e}},{key:"lastPen",get:function(){return this.pens[this.pens.length-1]}},{key:"lastLine",get:function(){return this.lines[this.lines.length-1]}},{key:"getLineStartIndex",value:function(t){if(t>=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;i<n;i++)(t=this.getLineWidth(i))>e&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e<i;e++)t.push(this.getLineWidth(e));return t}},{key:"linesCount",get:function(){return this.lines.length}},{key:"plainText",get:function(){for(var t="",e=this.pens,i=0,n=e.length;i<n;i++)t+=e[i].plainText;return t}},{key:"rawTextLength",get:function(){for(var t=0,e=this.pens,i=0,n=this.pens.length;i<n;i++)t+=e[i].rawTextLength;return t}},{key:"getSliceTagText",value:function(t,e,i){var n=this.lastPen;if(null==n)return "";var s=n.endIndex;void 0!==t&&0!==t||(t=-1),void 0!==e&&e!==s||(e=s+1),void 0===i&&(i=!1);for(var r,o,a,h,l,u,c="",d=0,f=this.pens.length;d<f&&((h=(r=this.pens[d]).endIndex)<=t||(r=this.pens[d],o=i?r.wrapText:r.plainText,l=r.prop,(a=r.startIndex)>=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),hi={},li=Phaser.Geom.Rectangle,ui=new at,ci=function(){function t(){h(this,t),this.hitAreas=[];}return u(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;t<e;t++)St(this.hitAreas[t].data);return ui.pushMultiple(this.hitAreas),this}},{key:"add",value:function(t,e,i,n,s){var r=ui.pop();return null===r?r=new li(t,e,i,n):r.setTo(t,e,i,n),r.data=s,this.hitAreas.push(r),this}},{key:"getFirst",value:function(t,e){for(var i=0,n=this.hitAreas.length;i<n;i++){var s=this.hitAreas[i];if(s.contains(t,e))return s}return null}},{key:"getByKey",value:function(t){for(var e=0,i=this.hitAreas.length;e<i;e++){var n=this.hitAreas[e];if(n.data.key===t)return n}return null}},{key:"drawBounds",value:function(t,e,i){void 0===e&&(e=16777215),i&&t.save().scaleCanvas(i.scaleX,i.scaleY).rotateCanvas(i.rotation).translateCanvas(i.x,i.y);for(var n=0,s=this.hitAreas.length;n<s;n++){var r=this.hitAreas[n];t.lineStyle(1,e).strokeRect(r.x,r.y,r.width,r.height);}return i&&t.restore(),this}}]),t}(),di=function(t,e,i,n){var s=this.hitAreaManager.getFirst(e,i);if(null!==s){var r=s.data.key;vi.call(this,"areadown",r,t,e,i,n),s.data.isDown=!0;}},fi=function(t,e,i,n){var s=this.hitAreaManager.getFirst(e,i);if(null!==s){var r=s.data,o=r.key;if(vi.call(this,"areaup",o,t,e,i,n),r.isDown){vi.call(this,"areaclick",o,t,e,i,n);var a=r.url;a&&window.open(a,"_blank");}r.isDown=!1;}},pi=function(t,e,i,n){if(null!==e){var s=this.hitAreaManager.getFirst(e,i),r=s?s.data.key:null;if(this.lastHitAreaKey!==r){if(null!==this.lastHitAreaKey){vi.call(this,"areaout",this.lastHitAreaKey,t,e,i,n);var o=this.hitAreaManager.getByKey(this.lastHitAreaKey);this.urlTagCursorStyle&&o.data.url&&(this.scene.input.manager.canvas.style.cursor=""),o.isDown=!1;}null!==r&&(vi.call(this,"areaover",r,t,e,i,n),this.urlTagCursorStyle&&s.data.url&&(this.scene.input.manager.canvas.style.cursor=this.urlTagCursorStyle)),this.lastHitAreaKey=r;}}else null!==this.lastHitAreaKey&&(vi.call(this,"areaout",this.lastHitAreaKey,t,e,i,n),this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown=!1,this.lastHitAreaKey=null);},vi=function(t,e,i,n,s,r){this.parent.emit("".concat(t,"-").concat(e),i,n,s,r),this.parent.emit(t,e,i,n,s,r);},gi=function(t){return /^[\x00-\x7F]+$/.test(t)},yi=We,mi=Ve,ki=Ye,bi=Ge,xi=Xe,Ci=He,wi=Ne,Si=function t(e,i,n,s,r,o){s<=0&&(n=bi);var a=[];if(!e||!e.length)return a;for(var h,l,u,c=n===bi,d=e.split(wi),f=0,p=d.length;f<p;f++)if(h=d[f],u=f===p-1?yi:mi,c){var v=i(h);a.push(o.getLine(h,v,u));}else {if(l=0===f?s-r:s,h.length<=100)if((v=i(h))<=l){a.push(o.getLine(h,v,u));continue}for(var g,y,m,k=Pi(h,n),b="",x=0,C=0,S=k.length;C<S;C++)if((y=i(g=k[C]))>s&&Ti(g)){""!==b?a.push(o.getLine(b,x,ki)):0===C&&r>0&&a.push(o.getLine("",0,ki)),a.push.apply(a,w(t(g,i,Ci,s,0,o)));var P=a.pop();b=P.text,x=P.width,o.freeLine(P)," "===b&&(b="",x=0);}else (m=x+y)>l?(a.push(o.getLine(b,x,ki)),b=g,x=y,l=s):(b+=g,x=m),C===S-1&&a.push(o.getLine(b,x,u));}return a},Pi=function(t,e){var i=[];switch(e){case xi:for(var n=0,s=(t=t.split(" ")).length;n<s;n++){var r=t[n];n<s-1?i.push(r+" "):""!==r&&i.push(r);}break;case Ci:i.push.apply(i,w(t.split("")));break;default:for(n=0,s=(t=t.split(" ")).length;n<s;n++){r=t[n];n<s-1?gi(r)?i.push(r+" "):(i.push.apply(i,w(r.split(""))),i.push(" ")):""!==r&&(gi(r)?i.push(r):i.push.apply(i,w(r.split(""))));}}return i},Ti=function(t){switch(t.length){case 1:return !1;case 2:return " "!==t.charAt(1);default:return !0}},Oi=Phaser.Utils.Objects.GetValue,Mi=Ge,Ei=We,_i=function(){function t(e){h(this,t),this.parent=e.parent,this.scene=this.parent.scene,this.context=Oi(e,"context",null),this.canvas=this.context.canvas,this.parser=Oi(e,"parser",null),this.defaultStyle=Oi(e,"style",null),this.autoRound=!0,this.pensPool=e.pensPool,this.linesPool=e.linesPool,this.wrapTextLinesPool=e.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new ci,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var i=this.context;this.getTextWidth=function(t){return i.measureText(t).width};}return u(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,s){if(void 0===s&&(s=this.penManager),s.clear(),""===t)return s;var r=this.parent.style;if(r.isWrapFitMode){var o=this.parent.padding;i=r.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,p=function(t){return f.measureText(t).width},v=0,g=0,y=r.wrapCallback,m=r.wrapCallbackScope,k=!0,b=this.parser.splitText(t),x=this.wrapTextLinesPool,C=0,w=b.length;C<w;C++)if(a=(u=this.parser.tagTextToProp(b[C],h)).plainText,(h=u.prop).img){var S=this.imageManager.getOuterWidth(h.img);i>0&&e!==Mi&&i<v+S&&(s.addNewLinePen(),g+=n,v=0),s.addImagePen(v,g,S,ni(h)),v+=S;}else if(""!==a){if(f.save(),(l=this.parser.propToContextStyle(this.defaultStyle,h)).buildFont(),l.syncFont(d,f),l.syncStyle(d,f),y){"string"==typeof(c=y.call(m,a,p,i,v))&&(c=c.split("\n"));for(var P=0,T=c.length;P<T;P++)"string"==typeof(O=c[P])?c[P]=x.getLine(O,p(O),P<T-1?2:0):k=!1;}else c=Si(a,p,e,i,v,x);var O;for(P=0,T=c.length;P<T;P++)O=c[P],s.addTextPen(O.text,v,g,O.width,ni(h),O.newLineMode),O.newLineMode!==Ei?(v=0,g+=n):v+=O.width;k&&x.freeLines(c),c=null,f.restore();}for(C=0,w=this.lines.length;C<w;C++){var M=this.lines[C],E=M[M.length-1];E&&(E.width+=this.parser.getStrokeThinkness(this.defaultStyle,E.prop));}return s}},{key:"startXOffset",get:function(){var t=this.defaultStyle;return t.strokeThickness/2+t.xOffset}},{key:"startYOffset",get:function(){var t=this.defaultStyle;return t.strokeThickness/2+t.metrics.ascent}},{key:"lines",get:function(){return this.penManager.lines}},{key:"desplayLinesCount",get:function(){var t=this.penManager.linesCount,e=this.defaultStyle.maxLines;return e>0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new ai({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var s=this.parser.splitText(t,1);n="";for(var r=0,o=s.length;r<o;r++)n+=s[r];}return null==e&&null==i||(null==e&&(e=0),null==i&&(i=n.length),n=n.substring(e,i)),n}},{key:"getPenManager",value:function(t,e){if(void 0===t)return this.copyPenManager(e,this.penManager);void 0===e&&(e=this.newPenManager());var i=this.defaultStyle;return this.updatePenManager(t,i.wrapMode,i.wrapWidth,i.lineHeight,e),e}},{key:"getText",value:function(t,e,i,n){if(null==t)return this.penManager.getSliceTagText(e,i,n);var s=this.tmpPenManager,r=this.defaultStyle;return this.updatePenManager(t,r.wrapMode,r.wrapWidth,r.lineHeight,s),s.getSliceTagText(e,i,n)}},{key:"copyPenManager",value:function(t,e){return void 0===e&&(e=this.penManager),e.copy(t)}},{key:"getTextWidth",value:function(t){return void 0===t&&(t=this.penManager),t.getMaxLineWidth()}},{key:"getLastPen",value:function(t){return void 0===t&&(t=this.penManager),t.lastPen}}]),t}(),Ri={setInteractive:function(){this.parent.on("pointerdown",di,this).on("pointerup",fi,this).on("pointermove",pi,this).on("pointerover",pi,this).on("pointerout",(function(t,e){pi.call(this,t,null,null,e);}),this);}};
/**
   * @author       Richard Davey <rich@photonstorm.com>
   * @copyright    2018 Photon Storm Ltd.
   * @license      {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
   */Object.assign(_i.prototype,$e,Ri);var Li=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"freeLine",value:function(t){if(t)return this.push(t),this}},{key:"freeLines",value:function(t){if(t)return this.pushMultiple(t),this}},{key:"getLine",value:function(t,e,i){var n=this.pop();return null===n&&(n={}),n.text=t,n.width=e,n.newLineMode=i,n}}]),i}(at),Bi=Phaser.Utils.Objects.IsPlainObject,Di=Phaser.Utils.Objects.GetValue,Ii=function(t,e){Bi(t)?t=(e=t).key:void 0===e&&(e={key:t}),e.hasOwnProperty("key")||(e.key=t);var i=e.key,n=e.frame,s=e.width,r=e.height;if(void 0===s||void 0===r){var o=this.textureManager.getFrame(i,n),a=o?o.cutWidth:0,h=o?o.cutHeight:0;void 0===s&&void 0===r?(s=a,r=h):void 0===s?s=a*(r/h):void 0===r&&(r=h*(s/a));}this.images[t]={key:i,frame:n,width:s,height:r,y:Di(e,"y",0),left:Di(e,"left",0),right:Di(e,"right",0),originX:Di(e,"originX",0),originY:Di(e,"originY",0),tintFill:Di(e,"tintFill",!1)};},ji=Phaser.Display.Canvas.CanvasPool,zi=function(t,e,i,n,s,r,o,a){void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=t.cutWidth),void 0===r&&(r=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),n=Math.round(n));var h=e.getContext("2d",{willReadFrequently:!0});if(o){var l=ji.create(null,s,r,Phaser.CANVAS,!0),u=l.getContext("2d",{willReadFrequently:!0});u.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,s,r),u.globalCompositeOperation="source-in",u.fillStyle=o,u.fillRect(0,0,s,r),h.drawImage(l,0,0,s,r,i,n,s,r),ji.remove(l);}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,n,s,r);},Ai=function(){function t(e){h(this,t),this.textureManager=e.sys.textures,this.images={};}return u(t,[{key:"destroy",value:function(){this.textureManager=void 0,this.images=void 0;}},{key:"add",value:function(t,e){if("string"==typeof t)Ii.call(this,t,e);else if(Array.isArray(t))for(var i=0,n=(s=t).length;i<n;i++)Ii.call(this,s[i]);else {var s=t;for(var t in s)Ii.call(this,t,s[t]);}return this}},{key:"has",value:function(t){return this.images.hasOwnProperty(t)}},{key:"remove",value:function(t){return this.has(t)&&delete this.images[t],this}},{key:"get",value:function(t){return this.has(t)||this.textureManager.exists(t)&&this.add(t),this.images[t]}},{key:"getOuterWidth",value:function(t){var e=this.get(t);return e?e.width+e.left+e.right:0}},{key:"getFrame",value:function(t){var e=this.get(t);return e?this.textureManager.getFrame(e.key,e.frame):void 0}},{key:"hasTexture",value:function(t){return !!this.getFrame(t)}}]),t}(),Fi={draw:function(t,e,i,n,s,r){var o=this.get(t),a=this.textureManager.getFrame(o.key,o.frame),h=o.width,l=o.height;i+=o.left-o.originX*h,n+=o.y-o.originY*l,o.tintFill||(s=void 0),zi(a,e.canvas,i,n,h,l,s,r);}};Object.assign(Ai.prototype,Fi);var Wi=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?"".concat(this.text,"\n").concat(t):"".concat(this.text).concat(t))!=this.text&&this.setText(i),this},Vi=Phaser.Utils.Objects.IsPlainObject,Yi=Phaser.DOM.AddToDOM,Gi=Phaser.Display.Canvas.CanvasPool,Xi=Phaser.GameObjects.GameObject,Hi=Phaser.Utils.Objects.GetValue,Ui=Phaser.DOM.RemoveFromDOM,Ni=Ne,Ki=Phaser.Utils.String.UUID,Ji=null,qi=null,Zi=null,$i=function(e){function i(e,n,s,r,o,a,l){var u;if(h(this,i),Vi(n)){var c=n;n=Hi(c,"x",0),s=Hi(c,"y",0),r=Hi(c,"text",""),o=Hi(c,"style");}if(void 0===n&&(n=0),void 0===s&&(s=0),(u=t(this,i,[e,a])).renderer=e.sys.game.renderer,u.setPosition(n,s),u.setOrigin(0,0),u.initPipeline(),u.initPostPipeline(!0),u.canvas=Gi.create(v(u)),u.context=u.canvas.getContext("2d",{willReadFrequently:!0}),u._imageManager=void 0,o){if(o.hasOwnProperty("align")){var d=o.align;delete o.align,o.halign=d;}o.hasOwnProperty("stroke")&&!o.hasOwnProperty("strokeThickness")&&(o.strokeThickness=1);}u.style=new qe(v(u),o);var f,p,g,y=Hi(o,"images",void 0);return y&&u.addImage(y),u.autoRound=!0,u._text=void 0,u.padding={left:0,right:0,top:0,bottom:0},u.width=1,u.height=1,u.lineSpacing=0,u.dirty=!1,0===u.style.resolution&&(u.style.resolution=1),u._crop=u.resetCropObject(),u._textureKey=Ki(),u.texture=e.sys.textures.addCanvas(u._textureKey,u.canvas),u.frame=u.texture.get(),u.frame.source.resolution=u.style.resolution,u.renderer&&u.renderer.gl&&(u.renderer.deleteTexture(u.frame.source.glTexture),u.frame.source.glTexture=null),Hi(o,"sharedPool",!0)?(Ji||(Ji={},qi=new at,Zi=new Li,u.scene.game.events.once("destroy",(function(){Ji=null,qi=null,Zi=null;}))),Ji.hasOwnProperty(a)||(Ji[a]=new at),f=Ji[a],p=qi,g=Zi):(f=new at,p=new at,g=new Li),u.canvasText=new _i({parent:v(u),context:u.context,parser:l,style:u.style,pensPool:f,linesPool:p,wrapTextLinesPool:g}),u.parser=l,u.initRTL(),o&&o.padding&&u.setPadding(o.padding),o&&o.lineSpacing&&u.setLineSpacing(o.lineSpacing),u.setText(r),u.setUrlTagCursorStyle(Hi(o,"urlTagCursorStyle","pointer")),Hi(o,"interactive",!1)&&u.setInteractive(),u}return d(i,e),u(i,[{key:"preDestroy",value:function(){Ui(this.canvas),this.canvasText.destroy(),this.canvasText=void 0,this._imageManager&&(this._imageManager.destroy(),this._imageManager=void 0),Gi.remove(this.canvas);var t=this.texture;t&&t.destroy();}},{key:"text",get:function(){return this._text},set:function(t){this.setText(t);}},{key:"initRTL",value:function(){this.style.rtl&&(this.canvas.dir="rtl",this.context.direction="rtl",this.canvas.style.display="none",Yi(this.canvas,this.scene.sys.canvas),this.originX=1);}},{key:"setRTL",value:function(t){void 0===t&&(t=!0);var e=this.style;if(e.rtl===t)return this;if(e.rtl=t,t?(this.canvas.dir="rtl",this.context.direction="rtl",this.canvas.style.display="none",Yi(this.canvas,this.scene.sys.canvas)):(this.canvas.dir="ltr",this.context.direction="ltr"),"left"===e.halign?e.halign="right":"right"===e.halign&&(e.halign="left"),this._imageManager){var i=this._imageManager.images;for(var n in i)i[n].originX=1-i[n].originX;}return this}},{key:"setText",value:function(t){return (t=null==t?"":Array.isArray(t)?t.join("\n"):t.toString())===this._text||(this._text=t,this.updateText()),this}},{key:"setPadding",value:function(t,e,i,n){if("object"===o(t)){var s=t,r=Hi(s,"x",null);null!==r?(t=r,i=r):(t=Hi(s,"left",0),i=Hi(s,"right",t));var a=Hi(s,"y",null);null!==a?(e=a,n=a):(e=Hi(s,"top",0),n=Hi(s,"bottom",e));}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===n&&(n=e);return this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=n,this.updateText(!1)}},{key:"updateText",value:function(t){void 0===t&&(t=!0);var e=this.canvasText,i=this.style;t&&e.updatePenManager(this._text,i.wrapMode,i.wrapWidth,i.lineHeight);var n,s,r=this.padding,a=Math.ceil(e.linesWidth);0===i.fixedWidth?(this.width=a+r.left+r.right,n=a):(this.width=i.fixedWidth,(n=this.width-r.left-r.right)<a&&(n=a)),0===i.fixedHeight?(this.height=e.linesHeight+r.top+r.bottom,s=e.linesHeight):(this.height=i.fixedHeight,(s=this.height-r.top-r.bottom)<e.linesHeight&&(s=e.linesHeight));var h=this.width,l=this.height;this.updateDisplayOrigin();var u=i.resolution;h*=u,l*=u,h=Math.max(Math.ceil(h),1),l=Math.max(Math.ceil(l),1);var c=this.canvas,d=this.context;c.width!==h||c.height!==l?(c.width=h,c.height=l,this.frame.setSize(h,l)):d.clearRect(0,0,h,l),d.save(),d.scale(u,u);var f=this.style.rtl?r.right:r.left,p=r.top;e.draw(f,p,n,s),d.restore(),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(c,this.frame.source.glTexture,!0),("undefined"==typeof WEBGL_DEBUG||o(WEBGL_DEBUG))&&(this.frame.glTexture.spectorMetadata={textureKey:"BBCodeText Game Object"})),this.dirty=!0;var v=this.input;return v&&!v.customHitArea&&(v.hitArea.width=this.width,v.hitArea.height=this.height),this}},{key:"toJSON",value:function(){var t=Components.ToJSON(this),e={autoRound:this.autoRound,text:this._text,style:this.style.toJSON(),resolution:this.resolution,padding:{left:this.padding.left,right:this.padding.right,top:this.padding.top,bottom:this.padding.bottom}};return t.data=e,t}},{key:"setInteractive",value:function(t,e,i){var n=!!this.input;return Xi.prototype.setInteractive.call(this,t,e,i),n||this.canvasText.setInteractive(),this}},{key:"setUrlTagCursorStyle",value:function(t){return this.urlTagCursorStyle=t,this}},{key:"urlTagCursorStyle",get:function(){return this.canvasText.urlTagCursorStyle},set:function(t){this.canvasText.urlTagCursorStyle=t;}},{key:"getWrappedText",value:function(t,e,i){return "number"==typeof t&&(i=e,e=t,t=void 0),(t=this.canvasText.getText(t,e,i,!0)).split(Ni)}},{key:"getPlainText",value:function(t,e,i){return "number"==typeof t&&(i=e,e=t,t=void 0),this.canvasText.getPlainText(t,e,i)}},{key:"getText",value:function(t,e,i,n){return "number"==typeof t&&(n=i,i=e,e=t,t=void 0),void 0===n&&(n=!1),this.canvasText.getText(t,e,i,n)}},{key:"getSubString",value:function(t,e,i){return "number"==typeof t&&(i=e,e=t,t=void 0),this.getText(t,e,i)}},{key:"copyPenManager",value:function(t){return this.canvasText.copyPenManager(t)}},{key:"getPenManager",value:function(t,e){return this.canvasText.getPenManager(t,e)}},{key:"setSize",value:function(t,e){return this.setFixedSize(t,e)}},{key:"resize",value:function(t,e){return this.setFixedSize(t,e)}},{key:"imageManager",get:function(){return this._imageManager||(this._imageManager=new Ai(this.scene)),this._imageManager}},{key:"addImage",value:function(t,e){return this.imageManager.add(t,e),this}},{key:"drawAreaBounds",value:function(t,e){return this.canvasText.hitAreaManager.drawBounds(t,e,this),this}},{key:"generateTexture",value:function(t,e,i,n,s){var r=this.canvas;return void 0===n?n=r.width:n*=this.resolution,void 0===s?s=r.height:s*=this.resolution,pe(this.scene,r,t,e,i,n,s),this}}]),i}(Ie),Qi={appendText:Wi};Object.assign($i.prototype,Qi);var tn,en,nn=!1,sn=!0,rn={plainText:null,prevProp:null},on=function(t,e,i,n){return e===sn?t[i]=n:t.hasOwnProperty(i)&&delete t[i],t},an=function(t){var e=t.b,i=t.weight,n=t.i;return e||i||n?n?e?"bold italic":i?"".concat(i," italic"):"italic":e?"bold":i.toString():""},hn=new qe,ln={},un=function(t){return t.replace(cn,"\\$&").replace(dn,"\\x2d")},cn=/[|\\{}()[\]^$+*?.]/g,dn=/-/g,fn={},pn=function(t,e,i,n){return void 0===n?"".concat(t).concat(i).concat(e):"".concat(t).concat(i,"=(").concat(n,")").concat(e)},vn=function(t,e,i){return "".concat(t,"/").concat(i).concat(e)},gn="[-.0-9]+",yn=["[a-zA-Z]+","#[0-9abcdef]+","rgba?\\(s*[.0-9]+s*(,s*[.0-9]+s*){2,3}\\)"].join("|"),mn=function(t,e){if(void 0===e){var i=t;t=i[0],e=i[1];}if(tn===t&&en===e)return !1;tn=t,en=e,t=un(t);var n=function(t){return "[^".concat(t,"]+")}(e=un(e)),s=pn(t,e,"esc"),r=vn(t,e,"esc"),o=pn(t,e,"raw"),a=vn(t,e,"raw"),h=pn(t,e,"b"),l=vn(t,e,"b"),u=pn(t,e,"i"),c=vn(t,e,"i"),d="weight",f=pn(t,e,d,gn),p=vn(t,e,d),v="size",g=pn(t,e,v,gn),y=vn(t,e,v),m="color",k=pn(t,e,m,yn),b=vn(t,e,m),x=pn(t,e,"u"),C=pn(t,e,"u",yn),w=vn(t,e,"u"),S=pn(t,e,"s"),P=pn(t,e,"s",yn),T=vn(t,e,"s"),O="shadow",M=pn(t,e,O),E=pn(t,e,O,yn),_=vn(t,e,O),R="stroke",L=pn(t,e,R),B=pn(t,e,R,yn),D=vn(t,e,R),I=pn(t,e,"y",gn),j=vn(t,e,"y"),z=pn(t,e,"img",n),A=vn(t,e,"img"),F="area",W=pn(t,e,F,n),V=vn(t,e,F),Y=pn(t,e,"url",n),G=vn(t,e,"url"),X="align",H=pn(t,e,X,n),U=vn(t,e,X),N=pn(t,e,"id",n),K=vn(t,e,"id");return fn.RE_ESC_OPEN=new RegExp(s,"i"),fn.RE_ESC_CLOSE=new RegExp(r,"i"),fn.RE_RAW_OPEN=new RegExp(o,"i"),fn.RE_RAW_CLOSE=new RegExp(a,"i"),fn.RE_BLOD_OPEN=new RegExp(h,"i"),fn.RE_BLOD_CLOSE=new RegExp(l,"i"),fn.RE_ITALICS_OPEN=new RegExp(u,"i"),fn.RE_ITALICS_CLOSE=new RegExp(c,"i"),fn.RE_WEIGHT_OPEN=new RegExp(f,"i"),fn.RE_WEIGHT_CLOSE=new RegExp(p,"i"),fn.RE_SIZE_OPEN=new RegExp(g,"i"),fn.RE_SIZE_CLOSE=new RegExp(y,"i"),fn.RE_COLOR_OPEN=new RegExp(k,"i"),fn.RE_COLOR_CLOSE=new RegExp(b,"i"),fn.RE_UNDERLINE_OPEN=new RegExp(x,"i"),fn.RE_UNDERLINE_OPENC=new RegExp(C,"i"),fn.RE_UNDERLINE_CLOSE=new RegExp(w,"i"),fn.RE_STRIKETHROUGH_OPEN=new RegExp(S,"i"),fn.RE_STRIKETHROUGH_OPENC=new RegExp(P,"i"),fn.RE_STRIKETHROUGH_CLOSE=new RegExp(T,"i"),fn.RE_SHADOW_OPEN=new RegExp(M,"i"),fn.RE_SHADOW_OPENC=new RegExp(E,"i"),fn.RE_SHADOW_CLOSE=new RegExp(_,"i"),fn.RE_STROKE_OPEN=new RegExp(L,"i"),fn.RE_STROKE_OPENC=new RegExp(B,"i"),fn.RE_STROKE_CLOSE=new RegExp(D,"i"),fn.RE_OFFSETY_OPEN=new RegExp(I,"i"),fn.RE_OFFSETY_CLOSE=new RegExp(j,"i"),fn.RE_IMAGE_OPEN=new RegExp(z,"i"),fn.RE_IMAGE_CLOSE=new RegExp(A,"i"),fn.RE_AREA_OPEN=new RegExp(W,"i"),fn.RE_AREA_CLOSE=new RegExp(V,"i"),fn.RE_URL_OPEN=new RegExp(Y,"i"),fn.RE_URL_CLOSE=new RegExp(G,"i"),fn.RE_ALIGN_OPEN=new RegExp(H,"i"),fn.RE_ALIGN_CLOSE=new RegExp(U,"i"),fn.RE_ID_OPEN=new RegExp(N,"i"),fn.RE_ID_CLOSE=new RegExp(K,"i"),fn.RE_SPLITTEXT=new RegExp([o,a,s,r,h,l,u,c,f,p,g,y,k,b,x,C,w,S,P,T,M,E,_,L,B,D,I,j,z,A,W,V,Y,G,H,U,N,K].join("|"),"ig"),!0},kn=function(t,e){return void 0!==t&&mn(t,e),Object.assign({},fn)},bn=Phaser.Utils.Objects.GetValue,xn=function(){function t(e){h(this,t);var i=bn(e,"delimiters","[]");this.tagRegex=kn(i),this.delimiters=i;}return u(t,[{key:"getStrokeThinkness",value:function(t,e){return e.hasOwnProperty("stroke")?t.strokeThickness:0}},{key:"setDelimiters",value:function(t,e){return mn(t,e)&&(this.tagRegex=kn()),this}}]),t}(),Cn={splitText:function(t,e){for(var i=this.tagRegex,n=[],s=0,r=!1,o=!1;;){var a=i.RE_SPLITTEXT.exec(t);if(!a)break;var h=a[0];if(o){if(!i.RE_ESC_CLOSE.test(h))continue;o=!1;}else if(r){if(!i.RE_RAW_CLOSE.test(h))continue;r=!1;}else i.RE_ESC_OPEN.test(h)?o=!0:i.RE_RAW_OPEN.test(h)&&(r=!0);var l=i.RE_SPLITTEXT.lastIndex,u=l-h.length;if(s<u){var c=t.substring(s,u);n.push(c);}void 0===e&&n.push(h),s=l;}var d=t.length;return s<d&&n.push(t.substring(s,d)),n},tagTextToProp:function(t,e){var i=this.tagRegex;null==e&&(e={});var n="";if(e.img&&on(e,nn,"img"),e.esc)i.RE_ESC_CLOSE.test(t)?on(e,nn,"esc"):n=t;else if(e.raw)i.RE_RAW_CLOSE.test(t)?on(e,nn,"raw"):n=t;else if(i.RE_ESC_OPEN.test(t))on(e,sn,"esc",!0);else if(i.RE_ESC_CLOSE.test(t))on(e,nn,"esc");else if(i.RE_RAW_OPEN.test(t))on(e,sn,"raw",!0);else if(i.RE_RAW_CLOSE.test(t))on(e,nn,"raw");else if(i.RE_BLOD_OPEN.test(t))on(e,sn,"b",!0);else if(i.RE_BLOD_CLOSE.test(t))on(e,nn,"b");else if(i.RE_ITALICS_OPEN.test(t))on(e,sn,"i",!0);else if(i.RE_ITALICS_CLOSE.test(t))on(e,nn,"i");else if(i.RE_WEIGHT_OPEN.test(t)){var s=t.match(i.RE_WEIGHT_OPEN);on(e,sn,"weight",s[1]);}else if(i.RE_WEIGHT_CLOSE.test(t))on(e,nn,"weight");else if(i.RE_SIZE_OPEN.test(t)){s=t.match(i.RE_SIZE_OPEN);on(e,sn,"size","".concat(s[1],"px"));}else if(i.RE_SIZE_CLOSE.test(t))on(e,nn,"size");else if(i.RE_COLOR_OPEN.test(t)){s=t.match(i.RE_COLOR_OPEN);on(e,sn,"color",s[1]);}else if(i.RE_COLOR_CLOSE.test(t))on(e,nn,"color");else if(i.RE_UNDERLINE_OPEN.test(t))on(e,sn,"u",!0);else if(i.RE_UNDERLINE_OPENC.test(t)){s=t.match(i.RE_UNDERLINE_OPENC);on(e,sn,"u",s[1]);}else if(i.RE_UNDERLINE_CLOSE.test(t))on(e,nn,"u");else if(i.RE_STRIKETHROUGH_OPEN.test(t))on(e,sn,"s",!0);else if(i.RE_STRIKETHROUGH_OPENC.test(t)){s=t.match(i.RE_STRIKETHROUGH_OPENC);on(e,sn,"s",s[1]);}else if(i.RE_STRIKETHROUGH_CLOSE.test(t))on(e,nn,"s");else if(i.RE_SHADOW_OPEN.test(t))on(e,sn,"shadow",!0);else if(i.RE_SHADOW_OPENC.test(t)){s=t.match(i.RE_SHADOW_OPENC);on(e,sn,"shadow",s[1]);}else if(i.RE_SHADOW_CLOSE.test(t))on(e,nn,"shadow");else if(i.RE_STROKE_OPEN.test(t))on(e,sn,"stroke",!0);else if(i.RE_STROKE_OPENC.test(t)){s=t.match(i.RE_STROKE_OPENC);on(e,sn,"stroke",s[1]);}else if(i.RE_STROKE_CLOSE.test(t))on(e,nn,"stroke");else if(i.RE_OFFSETY_OPEN.test(t)){s=t.match(i.RE_OFFSETY_OPEN);on(e,sn,"y",parseFloat(s[1]));}else if(i.RE_OFFSETY_CLOSE.test(t))on(e,nn,"y");else if(i.RE_IMAGE_OPEN.test(t)){s=t.match(i.RE_IMAGE_OPEN);on(e,sn,"img",s[1]);}else if(i.RE_IMAGE_CLOSE.test(t))on(e,nn,"img");else if(i.RE_AREA_OPEN.test(t)){s=t.match(i.RE_AREA_OPEN);on(e,sn,"area",s[1]);}else if(i.RE_AREA_CLOSE.test(t))on(e,nn,"area");else if(i.RE_URL_OPEN.test(t)){s=t.match(i.RE_URL_OPEN);on(e,sn,"url",s[1]);}else if(i.RE_URL_CLOSE.test(t))on(e,nn,"url");else if(i.RE_ALIGN_OPEN.test(t)){s=t.match(i.RE_ALIGN_OPEN);on(e,sn,"align",s[1]);}else if(i.RE_ALIGN_CLOSE.test(t))on(e,nn,"align");else if(i.RE_ID_OPEN.test(t)){s=t.match(i.RE_ID_OPEN);on(e,sn,"id",s[1]);}else i.RE_ID_CLOSE.test(t)?on(e,nn,"id"):n=t;var r=rn;return r.plainText=n,r.prop=e,r},propToContextStyle:function(t,e){var i=hn;if(e.hasOwnProperty("img"))i.image=e.img;else {if(i.image=null,e.hasOwnProperty("family")?i.fontFamily=e.family:i.fontFamily=t.fontFamily,e.hasOwnProperty("size")){var n=e.size;"number"==typeof n&&(n="".concat(n,"px")),i.fontSize=n;}else i.fontSize=t.fontSize;i.fontStyle=an(e),e.hasOwnProperty("color")?i.color=e.color:i.color=t.color,e.hasOwnProperty("stroke")?!0===e.stroke?(i.stroke=t.stroke,i.strokeThickness=t.strokeThickness):(i.stroke=e.stroke,i.strokeThickness=t.strokeThickness):(i.stroke=t.stroke,i.strokeThickness=0);}return e.hasOwnProperty("shadow")?!0===e.shadow?(i.shadowColor=t.shadowColor,i.shadowOffsetX=t.shadowOffsetX,i.shadowOffsetY=t.shadowOffsetY,i.shadowBlur=t.shadowBlur,i.shadowStroke=!0,i.shadowFill=!0):(i.shadowColor=e.shadow,i.shadowOffsetX=t.shadowOffsetX,i.shadowOffsetY=t.shadowOffsetY,i.shadowBlur=t.shadowBlur,i.shadowStroke=!0,i.shadowFill=!0):(i.shadowColor="#000",i.shadowOffsetX=0,i.shadowOffsetY=0,i.shadowBlur=0,i.shadowStroke=!1,i.shadowFill=!1),e.hasOwnProperty("u")?!0===e.u?(i.underlineColor=t.underlineColor,i.underlineThickness=t.underlineThickness,i.underlineOffset=t.underlineOffset):(i.underlineColor=e.u,i.underlineThickness=t.underlineThickness,i.underlineOffset=t.underlineOffset):(i.underlineColor="#000",i.underlineThickness=0,i.underlineOffset=0),e.hasOwnProperty("s")?!0===e.s?(i.strikethroughColor=t.strikethroughColor,i.strikethroughThickness=t.strikethroughThickness,i.strikethroughOffset=t.strikethroughOffset):(i.strikethroughColor=e.s,i.strikethroughThickness=t.strikethroughThickness,i.strikethroughOffset=t.strikethroughOffset):(i.strikethroughColor="#000",i.strikethroughThickness=0,i.strikethroughOffset=0),i},propToTagText:function(t,e,i){null==i&&(i=ln);var n=this.delimiters[0],s=this.delimiters[1],r=[];for(var o in i)e.hasOwnProperty(o)||r.push("".concat(n,"/").concat(o).concat(s));for(var o in e){var a=e[o];if(i[o]!==a)switch(o){case"size":r.push("".concat(n,"size=").concat(a.replace("px","")).concat(s));break;case"color":case"weight":case"stroke":case"y":case"img":case"area":case"url":case"align":case"id":r.push("".concat(n).concat(o,"=").concat(a).concat(s));break;case"u":case"s":!0===a?r.push("".concat(n).concat(o).concat(s)):r.push("".concat(n).concat(o,"=").concat(a).concat(s));break;default:r.push("".concat(n).concat(o).concat(s));}}return r.push(t),r.join("")}};Object.assign(xn.prototype,Cn);var wn=function(e){function i(e,n,s,r,o){return h(this,i),t(this,i,[e,n,s,r,o,"rexBBCodeText",new xn(o)])}return d(i,e),u(i,[{key:"setDelimiters",value:function(t,e){return this.parse.setDelimiters(t,e),this}}]),i}($i);E.register("BBCodeText",(function(t,e,i,n){var s=new wn(this.scene,t,e,i,n);return this.scene.add.existing(s),s})),Q(window,"RexPlugins.UI.BBCodeText",wn);var Sn={plainText:null,prevProp:null},Pn=new qe,Tn=function(){function t(e){h(this,t),void 0===e&&(e={}),this.tags=e;}return u(t,[{key:"addTag",value:function(t,e){this.tags[t]=e;}},{key:"getTag",value:function(t){return this.tags[t]}},{key:"splitText",value:function(t,e){for(var i=[],n=0;;){var s=En.exec(t);if(!s)break;var r=s[0],o=En.lastIndex-r.length;if(n<o&&i.push(t.substring(n,o)),void 0===e)i.push(r);else if(1===e)if(_n.test(r)){var a=r.match(Rn);i.push(a[2]);}else if(Ln.test(r)){a=r.match(Bn);i.push(a[2]);}n=En.lastIndex;}var h=t.length;return n<h&&i.push(t.substring(n,h)),i}},{key:"tagTextToProp",value:function(t,e){var i,n;if(_n.test(t)){if(null!=(o=t.match(Rn))){var s=o[1],r=this.tags;(n=r.hasOwnProperty(s)?r[s]:{})._class=s,i=o[2];}}else if(Ln.test(t)){var o;if(null!=(o=t.match(Bn))){var a=o[1];(n=On(a))._style=a,i=o[2];}}null==i&&(i=t),null==n&&(n={});var h=Sn;return h.plainText=i,h.prop=n,h}},{key:"propToContextStyle",value:function(t,e){var i=Pn;if(e.hasOwnProperty("img"))i.image=e.img;else {if(i.image=null,e.hasOwnProperty("family")||e.hasOwnProperty("fontFamily")||e.hasOwnProperty("font-family")){var n=e.hasOwnProperty("family")?e.family:e.hasOwnProperty("fontFamily")?e.fontFamily:e["font-family"];i.fontFamily=n;}else i.fontFamily=t.fontFamily;if(e.hasOwnProperty("size")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("font-size")){var s=e.hasOwnProperty("size")?e.size:e.hasOwnProperty("fontSize")?e.fontSize:e["font-size"];"number"==typeof s&&(s="".concat(s,"px")),i.fontSize=s;}else i.fontSize=t.fontSize;if(e.hasOwnProperty("style")||e.hasOwnProperty("fontStyle")||e.hasOwnProperty("font-style")){var r=e.hasOwnProperty("style")?e.style:e.hasOwnProperty("fontStyle")?e.fontStyle:e["font-style"];i.fontStyle=r;}else i.fontStyle=t.fontStyle;if(e.hasOwnProperty("color")||e.hasOwnProperty("font-color")){var o=e.hasOwnProperty("color")?e.color:e["font-color"];i.color=o;}else i.color=t.color;if(e.hasOwnProperty("stroke")){var a=e.stroke;i.stroke=a.hasOwnProperty("color")?a.color:t.stroke,i.strokeThickness=a.hasOwnProperty("thickness")?a.thickness:t.strokeThickness;}else i.stroke=t.stroke,i.strokeThickness=t.strokeThickness;}if(e.hasOwnProperty("shadow")){var h=e.shadow;i.shadowColor=h.hasOwnProperty("color")?h.color:t.shadowColor,i.shadowOffsetX=h.hasOwnProperty("offsetX")?h.offsetX:t.shadowOffsetX,i.shadowOffsetY=h.hasOwnProperty("offsetY")?h.offsetY:t.shadowOffsetY,i.shadowBlur=h.hasOwnProperty("blur")?h.blur:t.shadowBlur,i.shadowStroke=!0,i.shadowFill=!0;}else i.shadowColor=t.shadowColor,i.shadowOffsetX=t.shadowOffsetX,i.shadowOffsetY=t.shadowOffsetY,i.shadowBlur=t.shadowBlur,i.shadowStroke=t.shadowStroke,i.shadowFill=t.shadowFill;if(e.hasOwnProperty("u")||e.hasOwnProperty("underline")){var l=e.hasOwnProperty("u")?e.u:e.underline;i.underlineColor=l.hasOwnProperty("color")?l.color:t.underlineColor,i.underlineThickness=l.hasOwnProperty("thickness")?l.thickness:t.underlineThickness,i.underlineOffset=l.hasOwnProperty("offset")?l.offset:t.underlineOffset;}else i.underlineColor=t.underlineColor,i.underlineThickness=t.underlineThickness,i.underlineOffset=t.underlineOffset;if(e.hasOwnProperty("s")||e.hasOwnProperty("strikethrough")){var u=e.hasOwnProperty("s")?e.s:e.strikethrough;i.strikethroughColor=u.hasOwnProperty("color")?u.color:t.strikethroughColor,i.strikethroughThickness=u.hasOwnProperty("thickness")?u.thickness:t.strikethroughThickness,i.strikethroughOffset=u.hasOwnProperty("offset")?u.offset:t.strikethroughOffset;}else i.strikethroughColor=t.strikethroughColor,i.strikethroughThickness=t.strikethroughThickness,i.strikethroughOffset=t.strikethroughOffset;return i}},{key:"getStrokeThinkness",value:function(t,e){var i;if(e.hasOwnProperty("stroke")){var n=e.stroke;i=n.hasOwnProperty("thickness")?n.thickness:t.strokeThickness;}else i=t.strokeThickness;return i}},{key:"propToTagText",value:function(t,e,i){return e.hasOwnProperty("_class")?""===t&&this.isTextTag(e._class)?"":"<class='".concat(e._class,"'>").concat(t,"</class>"):e.hasOwnProperty("_style")?"<style='".concat(e._style,"'>").concat(t,"</style>"):t}},{key:"destroy",value:function(){this.tags=void 0;}},{key:"isTextTag",value:function(t){var e=this.tags[t];return !!e&&null==e.img}}]),t}(),On=function(t){for(var e,i,n,s={},r=0,o=(t=t.split(";")).length;r<o;r++)if(i=(e=t[r].split(":"))[0],n=e[1],!Mn(i)&&!Mn(n)){switch(i){case"stroke":var a=n.split(" ");n={},(h=a.length)>=1&&(n.color=a[0]),h>=2&&(n.thickness=parseInt(a[1].replace("px","")));break;case"shadow":a=n.split(" ");n={},(h=a.length)>=1&&(n.color=a[0]),h>=2&&(n.offsetX=parseInt(a[1].replace("px",""))),h>=3&&(n.offsetY=parseInt(a[2].replace("px",""))),h>=4&&(n.blur=parseInt(a[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var h;a=n.split(" ");n={},(h=a.length)>=1&&(n.color=a[0]),h>=2&&(n.thickness=parseInt(a[1].replace("px",""))),h>=3&&(n.offset=parseInt(a[2].replace("px",""))),"underline"===i?i="u":"strikethrough"===i&&(i="s");break;case"y":n=parseFloat(n);}s[i]=n;}return s},Mn=function(t){return 0===(t=t.replace(Dn,"")).length},En=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,_n=/<\s*class=/i,Rn=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,Ln=/<\s*style=/i,Bn=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,Dn=/^\s+|\s+$/,In=Phaser.Utils.Objects.GetValue,jn=function(e){function i(e,n,s,r,o){h(this,i);var a=In(o,"tags",void 0);return t(this,i,[e,n,s,r,o,"rexTagText",new Tn(a)])}return d(i,e),u(i,[{key:"addTag",value:function(t,e){return this.parser.addTag(t,e),this.updateText(!0)}},{key:"addTags",value:function(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}},{key:"getTag",value:function(t){return this.parser.getTag(t)}},{key:"preDestroy",value:function(){m(f(i.prototype),"preDestroy",this).call(this),this.parser.destroy(),this.parser=void 0;}}]),i}($i);E.register("tagText",(function(t,e,i,n){var s=new jn(this.scene,t,e,i,n);return this.scene.add.existing(s),s})),Q(window,"RexPlugins.UI.TagText",jn);var zn=Phaser.Utils.Objects.GetValue,An=function(t,e){return void 0===e?t:t[e]},Fn=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var n=o(e);return "string"===n?t[e]=i:"number"===n?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=zn(e,"left",0),t.right=zn(e,"right",0),t.top=zn(e,"top",0),t.bottom=zn(e,"bottom",0)),t},Wn=function(){function t(e,i){h(this,t),this.setParent(e),this.type=i,this.renderable=!1,this.reset().setActive();}return u(t,[{key:"destroy",value:function(){this.parent.removeChild(this);}},{key:"setParent",value:function(t){return this.parent=t,this}},{key:"scene",get:function(){return this.parent.scene}},{key:"canvas",get:function(){return this.parent?this.parent.canvas:null}},{key:"context",get:function(){return this.parent?this.parent.context:null}},{key:"setDirty",value:function(t){return t&&this.parent&&(this.parent.dirty=!0),this}},{key:"active",get:function(){return this._active},set:function(t){this.setDirty(this._active!=t),this._active=t;}},{key:"setActive",value:function(t){return void 0===t&&(t=!0),this.active=t,this}},{key:"modifyPorperties",value:function(t){return this}},{key:"onFree",value:function(){this.reset().setParent();}},{key:"reset",value:function(){return this}},{key:"render",value:function(){}},{key:"contains",value:function(t,e){return !1}}]),t}();Object.assign(Wn.prototype,Pt);var Vn,Yn,Gn,Xn,Hn,Un={renderContent:function(){},render:function(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation);}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}},Nn=Phaser.Math.RotateAround,Kn=Phaser.Geom.Rectangle,Jn=function(t){void 0===Yn&&(Yn=new Kn);var e=t.drawTLX,i=t.drawTLY;return Yn.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Yn},qn=Phaser.Math.RotateAround,Zn=function(t,e,i,n){return void 0===n?n={}:!0===n&&(void 0===Gn&&(Gn={}),n=Gn),n.x=e,n.y=i,0!==t.rotation&&qn(n,0,0,t.rotation),n.x=n.x*t.scaleX+t.drawX,n.y=n.y*t.scaleY+t.drawY,n},$n=Phaser.GameObjects.Components.TransformMatrix,Qn={},ts=function(t,e,i,n,s){var r=Zn(e,i,n,!0),o=function(t,e,i,n){void 0===n?n={}:!0===n&&(n=Qn);var s=e-t.width*t.originX,r=i-t.height*t.originY;return void 0===Xn&&(Xn=new $n,Hn=new $n),t.parentContainer?t.getWorldTransformMatrix(Xn,Hn):Xn.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Xn.transformPoint(s,r,n),n}(t,r.x,r.y,s);return o},es=function(t,e,i,n,s){"number"!=typeof i&&(s=i,i=0,n=0);var r=e.drawCenterX+i,o=e.drawCenterY+n;return ts(t,e,r,o,s)},is={contains:function(t,e){if(0===this.width||0===this.height)return !1;var i=function(t,e,i,n){return void 0===n?n={}:!0===n&&(void 0===Vn&&(Vn={}),n=Vn),n.x=(t-i.drawX)/i.scaleX,n.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Nn(n,0,0,-i.rotation),n}(t,e,this,!0);return Jn(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return es(this.parent,this,t,e,i)}};Object.assign(is,Un);var ns=Phaser.Math.DegToRad,ss=Phaser.Math.RadToDeg,rs=Phaser.Utils.Objects.GetValue,os=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).renderable=!0,s.scrollFactorX=1,s.scrollFactorY=1,s.toLocalPosition=!0,s.originX=0,s.offsetX=0,s.offsetY=0,s}return d(i,e),u(i,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return ss(this._rotation)},set:function(t){this.rotation=ns(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=rs(t,"width",void 0),i=rs(t,"height",void 0),n=rs(t,"scaleX",void 0),s=rs(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===s?this.setWidth(e,!0):this.setWidth(e):void 0!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?this.setHeight(i,!0):this.setHeight(i):void 0!==s&&this.setScaleY(s),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),i}(Wn);Object.assign(os.prototype,is);var as=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},hs=Phaser.Utils.Objects.GetValue,ls=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,"background"])).setScrollFactor(0),s.setColor(hs(n,"color",null),hs(n,"color2",null),hs(n,"horizontalGradient",!0)),s.setStroke(hs(n,"stroke",null),hs(n,"strokeThickness",2)),s.setCornerRadius(hs(n,"cornerRadius",0),hs(n,"cornerIteration",null)),s}return d(i,e),u(i,[{key:"color",get:function(){return this._color},set:function(t){t=Ce(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Ce(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Ce(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,as("color2",t,this),as("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,as("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,as("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return m(f(i.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){Me(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),i}(os),us=Phaser.Utils.Objects.GetValue,cs=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,"innerbounds"])).setScrollFactor(0),s.setColor(us(n,"color",null),us(n,"color2",null),us(n,"horizontalGradient",!0)),s.setStroke(us(n,"stroke",null),us(n,"strokeThickness",2)),s}return d(i,e),u(i,[{key:"color",get:function(){return this._color},set:function(t){t=Ce(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Ce(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Ce(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){m(f(i.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,us(t,"color2",null),us(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,us(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,s=this.parent.height-t.top-t.bottom,r=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?r.createLinearGradient(0,0,n,0):r.createLinearGradient(0,0,0,s)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;r.fillStyle=o,r.fillRect(e,i,n,s);}null!=this.stroke&&this.strokeThickness>0&&(r.strokeStyle=this.stroke,r.lineWidth=this.strokeThickness,r.strokeRect(e,i,n,s));}}]),i}(os),ds=Phaser.Utils.Objects.GetValue,fs=function(){function t(e,i){h(this,t),this.parent=e,this.set(i);}return u(t,[{key:"toJSON",value:function(){return {bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}},{key:"set",value:function(t){return this.setBold(ds(t,"bold",!1)),this.setItalic(ds(t,"italic",!1)),this.setFontSize(ds(t,"fontSize","16px")),this.setFontFamily(ds(t,"fontFamily","Courier")),this.setColor(ds(t,"color","#fff")),this.setStrokeStyle(ds(t,"stroke",null),ds(t,"strokeThickness",0)),this.setShadow(ds(t,"shadowColor",null),ds(t,"shadowOffsetX",0),ds(t,"shadowOffsetY",0),ds(t,"shadowBlur",0)),this.setOffset(ds(t,"offsetX",0),ds(t,"offsetY",0)),this.setSpace(ds(t,"leftSpace",0),ds(t,"rightSpace",0)),this.setAlign(ds(t,"align",void 0)),this.setBackgroundColor(ds(t,"backgroundColor",null)),this.setBackgroundHeight(ds(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ds(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(as("stroke",t,this),as("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(as("shadowOffsetX",t,this),as("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=Ce(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=Ce(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=Ce(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=Ce(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}},{key:"syncShadow",value:function(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),ps=Phaser.Utils.Array.Remove,vs=Phaser.Utils.Array.Remove,gs="text",ys="image",ms="drawer",ks="space",bs="command",xs=function(t){return t.type===gs&&"\n"===t.text},Cs=function(t){return t.type===gs&&"\f"===t.text},ws=function(t){return t.type===gs},Ss=function(t){return t.type===bs},Ps=function(e){function i(e,n,s){var r;return h(this,i),(r=t(this,i,[e,gs])).updateTextFlag=!1,r.style=new fs(v(r),s),r.setText(n),r}return d(i,e),u(i,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),b(f(i.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),b(f(i.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),m(f(i.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&m(f(i.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,s=e.backgroundBottomY;null==s&&(s=this.drawBLY);var r=e.backgroundHeight;null==r&&(r=s-this.drawTLY);var o=s-r;t.fillRect(i,o,n,r);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),i}(os),Ts=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};Phaser.Display.Canvas.CanvasPool;var Os=function(e){function i(e,n,s){var r;return h(this,i),(r=t(this,i,[e,ys])).setTexture(n,s),r.color=void 0,r}return d(i,e),u(i,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setColor",value:function(t){return this.color=t,this}},{key:"modifyPorperties",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color),m(f(i.prototype),"modifyPorperties",this).call(this,t),this}},{key:"renderContent",value:function(){zi(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),i}(os),Ms=function(t,e,i){var n=this.createImageChild(t,e,i);return this.addChild(n),this},Es=function(e){function i(e,n,s,r){var o;return h(this,i),(o=t(this,i,[e,ms])).setRenderCallback(n),o.setDrawerSize(s,r),o}return d(i,e),u(i,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(t,e){return !0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}},{key:"onFree",value:function(){m(f(i.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),i}(os),_s=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,ks])).setSpaceWidth(n),s}return d(i,e),u(i,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),i}(os),Rs=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this},Ls=function(e){function i(e,n,s,r,o){var a;return h(this,i),(a=t(this,i,[e,bs])).setName(n).setParameter(r).setCallback(s,o),a}return d(i,e),u(i,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){m(f(i.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),i}(Wn),Bs=function(t,e,i,n){var s=this.createCommandChild(t,e,i,n);return this.addChild(s),this},Ds=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)},Is=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var s=t.length,r=e,o=n.word,a=0;r<s;){var h=t[r];if(h.renderable){var l=h.type===gs?h.text:null;if(null===l||" "===l||"\n"===l||"\f"===l){r===e&&(o.push(h),a+=h.outerWidth);break}if(o.push(h),a+=h.outerWidth,r++,i)break}else o.push(h),r++;}return n.width=a,n},js=function(t){for(var e=0,i=t.length;e<i;e++){var n=t[e];if(void 0!==n.align)return n.align}},zs=function(t,e,i){if(0!==e||0!==i)for(var n=0,s=t.length;n<s;n++){var r=t[n];r.renderable&&(r.x+=e,r.y+=i);}},As=function(){var t,e,i=this.defaultTextStyle.getTextMetrics(this.context,this.testString);return "actualBoundingBoxAscent"in i?(t=i.actualBoundingBoxAscent,e=i.actualBoundingBoxDescent):(t=0,e=0),Fs.ascent=t,Fs.descent=e,Fs.height=t+e,Fs},Fs={},Ws=Phaser.Utils.Objects.GetValue,Vs=function(t){var e=Ws(t,"start",0);Fn(this.wrapPadding,Ws(t,"padding",0));var i,n=this.padding.top+this.padding.bottom+this.wrapPadding.top+this.wrapPadding.bottom,s=this.padding.left+this.padding.right+this.wrapPadding.left+this.wrapPadding.right,r=Ws(t,"lineHeight"),o=Ws(t,"ascent",r);if(void 0===r){var a=Ws(t,"useDefaultTextHeight",!1);if(i=Ws(t,"maxLines",0),this.fixedHeight>0&&!a){var h=this.fixedHeight-n;if(i>0)r=h/i;else r=(l=As.call(this)).height,o=l.ascent,i=Math.floor((h-o)/r);}else {var l;r=(l=As.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Ws(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/r);}}else i=Ws(t,"maxLines",0);void 0===o&&(o=r);var u=0===i,c=Ws(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-s:1/0);for(var d=Ws(t,"letterSpacing",0),f=Ws(t,"hAlign",0),p=Ws(t,"vAlign",0),v=Ws(t,"charWrap",!1),g=Ds({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:f,vAlign:p,ascent:o,lineHeight:r,wrapWidth:c,charWrap:v}),y=this.children,m=0,k=y.length;m<k;m++)y[m].setActive(!1);c+=d;for(var b,x=this.padding.left+this.wrapPadding.left,C=x,w=this.padding.top+this.wrapPadding.top+o,S=c,P=e,T=y.length,O=g.children,M=g.lines,E=[],_=0,R=0,L=!1;P<T;){var B=(b=Is(y,P,v,b)).word,D=B.length,I=b.width+D*d;P+=D;var j=xs(B[0]);L=Cs(B[0]);var z=j||L;if(S<I||z){if(z){var A=B[0];A.setActive().setPosition(C,w),O.push(A),E.push(A);}if(C=x,w+=r,S=c,M.push({children:E,width:_}),R=Math.max(R,_),_=0,E=[],L||!u&&M.length===i)break;if(z)continue}S-=I,_+=I;for(m=0,k=B.length;m<k;m++){(V=B[m]).setActive(),O.push(V),E.push(V),V.renderable&&(V.setPosition(C,w),C+=V.outerWidth+d);}}E.length>0&&(M.push({children:E,width:_}),R=Math.max(R,_)),g.start+=O.length,g.isLastPage=!L&&g.start===T,g.maxLineWidth=R,g.linesHeight=M.length*r;var F=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+s,W=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,s,r=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":s=(i-a)/2;break;case 2:case"bottom":s=i-a;break;default:s=0;}for(var h=t.lines,l=0,u=h.length;l<u;l++){var c=h[l],d=c.width,f=c.children,p=js(f);switch(void 0===p&&(p=r),p){case 1:case"center":n=(e-d)/2;break;case 2:case"right":n=e-d;break;default:n=0;}zs(f,n,s);}}(g,F-s,h=W-n),this.setCanvasSize(F,W);for(m=0,k=O.length;m<k;m++){var V;(V=O[m]).renderable&&(V.x0=V.x,V.y0=V.y);}return g},Ys=Phaser.Utils.Objects.Merge,Gs=Phaser.Utils.Objects.GetValue,Xs=function(t){var e=Gs(t,"start",0);Fn(this.wrapPadding,Gs(t,"padding",0));var i,n=this.padding.top+this.padding.bottom+this.wrapPadding.top+this.wrapPadding.bottom,s=this.padding.left+this.padding.right+this.wrapPadding.left+this.wrapPadding.right,r=Gs(t,"lineWidth",void 0);if(void 0===r)i=Gs(t,"maxLines",0),r=this.fixedWidth>0?(o=this.fixedWidth-s)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Gs(t,"maxLines",void 0))){var o=this.fixedWidth-s;i=Math.floor(o/r)+1;}}else i=Gs(t,"maxLines",0);var a=0===i,h=Gs(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Gs(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=Gs(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=Gs(t,"letterSpacing",0),f=Gs(t,"rtl",!0),p=Gs(t,"hAlign",f?2:0),v=Gs(t,"vAlign",0),g=Ds({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:p,vAlign:v,lineWidth:r,fixedCharacterHeight:h,wrapHeight:c,rtl:f}),y=this.children,m=0,k=y.length;m<k;m++)y[m].setActive(!1);c+=d;for(var b=this.padding.left+this.wrapPadding.left,x=this.padding.top+this.wrapPadding.top,C=b,w=x,S=c,P=e,T=y.length,O=g.children,M=g.lines,E=[],_=0,R=0;P<T;){var L=y[P];if(P++,L.renderable){var B=(void 0!==h?h:L.height)+d,D=xs(L),I=Cs(L),j=D||I;if(S<B||j){if(D&&(L.setActive().setPosition(C,w).setOrigin(.5),O.push(L),E.push(L)),C=b,w=x,S=c,M.push({children:E,height:_}),R=Math.max(R,_),_=0,E=[],I||!a&&M.length===i)break;if(j)continue}S-=B,_+=B,L.setActive().setPosition(C,w).setOrigin(.5),O.push(L),E.push(L),w+=B;}else L.setActive(),O.push(L),E.push(L);}E.length>0&&(M.push({children:E,height:_}),R=Math.max(R,_)),g.start+=O.length,g.isLastPage=g.start===T,g.maxLineHeight=R,g.linesWidth=M.length*r;var z=this.fixedWidth>0?this.fixedWidth:g.linesWidth+s,A=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,s,r=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(r){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c<d;c++){var f=h[a?d-c-1:c],p=f.children,v=f.height,g=js(p);switch(void 0===g&&(g=o),g){case 1:case"center":s=(i-v)/2;break;case 2:case"bottom":s=i-v;break;default:s=0;}zs(p,n,s),n+=l;}}(g,o=z-s,u=A-n),this.setCanvasSize(z,A);for(m=0,k=O.length;m<k;m++){(L=O[m]).renderable&&(L.x0=L.x,L.y0=L.y);}return g},Hs=Phaser.Utils.Objects.Merge,Us=Phaser.Utils.Objects.GetValue,Ns=Phaser.Utils.Array.GetAll,Ks=Phaser.Math.Distance.BetweenPointsSquared,Js=function(t,e,i){for(var n=0,s=(t=t).length;n<s;n++){var r=t[n];if(r.active&&r.renderable&&r.contains(e,i))return r}return null},qs=function(){return this.on("pointerdown",Zs,this).on("pointerdown",$s,this).on("pointermove",Qs,this).on("pointerover",Qs,this).on("pointerout",(function(t,e){Qs.call(this,t,null,null,e);}),this),this},Zs=function(t,e,i,n){if(this.childrenInteractiveEnable){var s=Js(this.children,e,i);s&&this.emit("child.pointerdown",s,t,e,i,n);}},$s=function(t,e,i,n){if(this.childrenInteractiveEnable){var s=Js(this.children,e,i);s&&this.emit("child.pointerup",s,t,e,i,n);}},Qs=function(t,e,i,n){if(this.childrenInteractiveEnable)if(null!==e){var s=Js(this.children,e,i);s!==this.lastOverChild&&(null!==this.lastOverChild&&this.emit("child.pointerout",this.lastOverChild,t,e,i,n),null!==s&&this.emit("child.pointerover",s,t,e,i,n),this.lastOverChild=s);}else null!==this.lastOverChild&&(this.emit("child.pointerout",this.lastOverChild,t,e,i,n),this.lastOverChild=null);},tr=Phaser.GameObjects.GameObject,er=Phaser.Utils.Array.BringToTop,ir=Phaser.Utils.Array.SendToBack,nr=Phaser.Utils.Array.MoveUp,sr=Phaser.Utils.Array.MoveDown,rr=Phaser.Utils.Array.MoveAbove,or=Phaser.Utils.Array.MoveBelow,ar={moveChildToFist:function(t){return ir(this.children,t),this},moveChildToLast:function(t){return er(this.children,t),this},movechildUp:function(t){return nr(this.children,t),this},movechildDown:function(t){return sr(this.children,t),this},movechildAbove:function(t,e){return rr(this.children,t,e),this},movechildBelow:function(t,e){return or(this.children,t,e),this}},hr={setFixedSize:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.fixedWidth===t&&this.fixedHeight===e||(this.fixedWidth=t,this.fixedHeight=e,this.dirty=!0,this.setCanvasSize(t>0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,n=i.left,s=i.right,r=i.top,o=i.bottom;return Fn(i,t,e),this.dirty=this.dirty||n!=i.left||s!=i.right||r!=i.top||o!=i.bottom,this},getPadding:function(t){return An(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),ps(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return vs(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i,n,s,r=Array.isArray(t);void 0===e||e===this.children.length?r?(i=this.children).push.apply(i,w(t)):this.children.push(t):r?(n=this.children).splice.apply(n,[e,0].concat(w(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,r)?(s=this.lastAppendedChildren).push.apply(s,w(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(gs);return null===i?i=new Ps(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],n=0,s=t.length;n<s;n++){var r=t.charAt(n),o=this.poolManager.allocate(gs);null===o?o=new Ps(this,r,this.textStyle):o.setParent(this).setActive().modifyStyle(this.textStyle).setText(r),i.push(o);}return i},setText:function(t,e){return void 0===t&&(t=""),this.removeChildren(),Ts.call(this,t,e),this.dirty=!0,this},appendText:Ts,insertText:function(t,e,i){var n=this.createCharChildren(e,i);return t=this.getCharChildIndex(t,!0),this.addChild(n,t),this},removeText:function(t,e){void 0===e&&(e=1);for(var i=0;i<e;i++){var n=this.getCharChildIndex(t,!0);if(void 0===n)break;this.removeChild(this.children[n]);}return this},getText:function(t){var e="";return this.forEachCharChild((function(t){e+=t.text;}),void 0,t),e},createImageChild:function(t,e,i){var n=this.poolManager.allocate(ys);return null===n?n=new Os(this,t,e):n.setParent(this).setActive().setTexture(t,e),n.modifyPorperties(i),n},appendImage:Ms,createDrawerChild:function(t,e,i){var n=this.poolManager.allocate(ms);return null===n?n=new Es(this,t,e,i):n.setParent(this).setActive().setRenderCallback(t).setDrawerSize(e,i),n},appendDrawer:function(t,e,i){var n=this.createDrawerChild(t,e,i);return this.addChild(n),this},createSpaceChild:function(t){var e=this.poolManager.allocate(ks);return null===e?e=new _s(this,t):e.setParent(this).setActive().setSpaceWidth(t),e},appendSpace:Rs,createCommandChild:function(t,e,i,n){var s=this.poolManager.allocate(bs);return null===s?s=new Ls(this,t,e,i,n):s.setParent(this).setActive().setName(t).setCallback(e,n).setParameter(i),s},appendCommand:Bs,setWrapConfig:function(t){return void 0===t?t={}:"object"===o(t)&&(t=R(t)),this.wrapConfig=t,this},runWordWrap:function(t){return void 0===t&&(t={}),Vs.call(this,Ys(t,this.wrapConfig))},runVerticalWrap:function(t){return void 0===t&&(t={}),Xs.call(this,Hs(t,this.wrapConfig))},runWrap:function(t){var e=Us(this.wrapConfig,"callback");return e||(e=Us(t,"callback",this.runWordWrap)),"string"==typeof e&&(e=this[e]),e.call(this,t)},renderContent:function(){var t;this.clear(),this.setCanvasSize(this.width,this.height),this.background.active&&this.background.render();for(var e=0,i=this.children.length;e<i;e++)(t=this.children[e]).active&&t.render();this.innerBounds.active&&this.innerBounds.render();},forEachChild:function(t,e,i){void 0===i&&(i=!0);for(var n=this.children,s=0,r=0,o=n.length;r<o;r++){var a,h=n[r];if(!i||h.active)if(a=e?t.call(this,h,s,n):t(h,s,n),s++,a)break}return this},forEachRenderableChild:function(t,e,i){void 0===i&&(i=!0);for(var n=this.children,s=0,r=0,o=n.length;r<o;r++){var a,h=n[r];if(!i||h.active)if(h.renderable&&!h.removed)if(a=e?t.call(this,h,s,n):t(h,s,n),s++,a)break}return this},forEachCharChild:function(t,e,i){void 0===i&&(i=!0);for(var n=this.children,s=0,r=0,o=n.length;r<o;r++){var a,h=n[r];if(!i||h.active)if(ws(h)&&!h.removed)if(a=e?t.call(this,h,s,n):t(h,s,n),s++,a)break}return this},getChildren:function(){return this.children},getActiveChildren:function(){return Ns(this.children,"active",!0)},getCharChildren:function(t,e){return void 0===e&&(e=[]),this.forEachCharChild((function(t){e.push(t);}),void 0,t),e},getLastAppendedChildren:function(){return this.lastAppendedChildren},getNearestChild:function(t,e){var i={x:t,y:e},n=1/0,s=null;return this.forEachRenderableChild((function(t){var e=Ks(i,function(t,e,i,n){"number"!=typeof e&&(n=e,e=0,i=0);var s=t.drawCenterX+e,r=t.drawCenterY+i;return Zn(t,s,r,n)}(t,!0));n>e&&(n=e,s=t);})),s},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),es(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,s=t.length;n<s;n++){var r=t[n];if(r.renderable&&r.active&&r.visible){var o=void 0!==r.x0?r.x0:r.x,a=void 0!==r.y0?r.y0:r.y;e=Math.max(e,o),i=Math.max(i,a);}}var h=e+this.padding.left+this.padding.right+this.wrapPadding.left+this.wrapPadding.right,l=i+this.padding.top+this.padding.bottom+this.wrapPadding.top+this.wrapPadding.bottom;return this.width===h&&this.height===l||(this.dirty=!0,this.setCanvasSize(h,l)),this},getCharChildIndex:function(t,e){void 0===e&&(e=!0);for(var i=this.children,n=0,s=i.length;n<s;n++){var r=i[n];if((!e||r.active)&&(ws(r)&&!r.removed)){if(0===t)return n;t--;}}},getCharChild:function(t,e){void 0===e&&(e=!0);for(var i=this.children,n=0,s=i.length;n<s;n++){var r=i[n];if((!e||r.active)&&(ws(r)&&!r.removed)){if(0===t)return r;t--;}}},getCharIndex:function(t,e){if("number"!=typeof t&&(t=this.children.indexOf(t))<0)return null;void 0===e&&(e=!0);var i=this.children;t>=i.length&&(t=i.length);for(var n=0,s=0;s<t;s++){var r=i[s];e&&!r.active||ws(r)&&!r.removed&&n++;}return n},setChildrenInteractiveEnable:function(t){return void 0===t&&(t=!0),this.childrenInteractiveEnable!==t&&(this.lastOverChild=null),this.childrenInteractiveEnable=t,this},setInteractive:function(t,e,i){var n=!!this.input;return tr.prototype.setInteractive.call(this,t,e,i),n||qs.call(this),this}};Object.assign(hr,ar,{setBackgroundColor:function(t,e,i){return this.background.setColor(t,e,i),this},setBackgroundStroke:function(t,e){return this.background.setStroke(t,e),this},setBackgroundCornerRadius:function(t,e){return this.background.setCornerRadius(t,e),this}},{setInnerBoundsColor:function(t,e,i){return this.innerBounds.setColor(t,e,i),this},setInnerBoundsStroke:function(t,e){return this.innerBounds.setStroke(t,e),this}},{setVAlign:function(t){return this.wrapConfig.vAlign=t,this},setHAlign:function(t){return this.wrapConfig.hAlign=t,this}},{setTextOX:function(t){return t===this._textOX||(this._textOX=t),this},setTextOY:function(t){return t===this._textOY||(this._textOY=t),this},setTextOXY:function(t,e){if(t!==this._textOX||e!==this._textOY)return this._textOX=t,this._textOY=e,this},addTextOX:function(t){return this.setTextOX(this._textOX+t),this},addTextOY:function(t){return this.setTextOY(this._textOY+t),this},addTextOXY:function(t,e){return this.setTextOXY(this._textOX+t,this._textOY+e),this}});var lr=Phaser.Utils.Objects.GetFastValue,ur={},cr=function(){function t(e){h(this,t),this.pools=lr(e,"pools",ur);}return u(t,[{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new at),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e<i;e++)this.free(t[e]);return this}},{key:"allocate",value:function(t){return this.pools&&this.pools.hasOwnProperty(t)?this.pools[t].pop():null}}]),t}(),dr=Phaser.Utils.Objects.IsPlainObject,fr=Phaser.Utils.Objects.GetValue,pr=function(e){function i(e,n,s,r,o,a){var l;h(this,i),dr(n)?(n=fr(a=n,"x",0),s=fr(a,"y",0),r=fr(a,"width",0),o=fr(a,"height",0)):dr(r)&&(r=fr(a=r,"width",0),o=fr(a,"height",0)),(l=t(this,i,[e,n,s,0===r?1:r,0===o?1:o])).type="rexDynamicText",l.autoRound=!0,l.padding=Fn(),l.wrapPadding=Fn();var u=fr(a,"style",void 0);l.defaultTextStyle=new fs(null,u),l.textStyle=l.defaultTextStyle.clone(),l.setTestString(fr(a,"testString","|MÉqgy")),l._textOX=0,l._textOY=0,l.background=new ls(v(l),fr(a,"background",void 0)),l.innerBounds=new cs(v(l),fr(a,"innerBounds",void 0)),l.children=[],l.lastAppendedChildren=[],l.lastOverChild=null,l.poolManager=new cr(a),l.setFixedSize(r,o),l.setPadding(fr(a,"padding",0)),l.setWrapConfig(fr(a,"wrap",void 0)),l.setChildrenInteractiveEnable(fr(a,"childrenInteractive",!1));var c=fr(a,"text",void 0);return c&&l.setText(c),l}return d(i,e),u(i,[{key:"updateTexture",value:function(){return this.renderContent(),m(f(i.prototype),"updateTexture",this).call(this),this}},{key:"text",get:function(){return this.getText(!0)},set:function(t){this.setText(t);}},{key:"setSize",value:function(t,e){return this.setFixedSize(t,e),this}},{key:"textOX",get:function(){return this._textOX},set:function(t){this.setTextOX(t);}},{key:"textOY",get:function(){return this._textOY},set:function(t){this.setTextOY(t);}}]),i}(ke);Object.assign(pr.prototype,hr),E.register("dynamicText",(function(t,e,i,n,s){var r=new pr(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.DynamicText",pr);var vr={setEventEmitter:function(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter:function(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter:function(){return this._eventEmitter},on:function(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once:function(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off:function(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit:function(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener:function(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener:function(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners:function(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount:function(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners:function(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames:function(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},gr={hasProperty:function(t){var e=this.gameObject;return !!e.hasOwnProperty(t)||void 0!==e[t]},getProperty:function(t){return this.gameObject[t]},setProperty:function(t,e){return this.gameObject[t]=e,this},easeProperty:function(t,e,i,n,s,r,o,a){void 0===a&&(a=this.gameObject);var h=this.tweens,l=h[t];l&&l.remove();var u={targets:a,duration:i,ease:n,repeat:s,yoyo:r,onComplete:function(){h[t].remove(),h[t]=null,o&&o(a,t);},onCompleteScope:this};return u[t]=e,(l=this.scene.tweens.add(u)).timeScale=this.timeScale,h[t]=l,this},getTweenTask:function(t){return this.tweens[t]},freeTweens:function(){var t,e=this.tweens;for(var i in e)(t=e[i])&&t.remove(),e[i]=null;return this}},yr={hasMethod:function(t){return "function"==typeof this.gameObject[t]},call:function(t){if(!this.hasMethod(t))return this;for(var e=this.gameObject,i=arguments.length,n=new Array(i>1?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];return e[t].apply(e,n),this}},mr=function(){function t(e,i,n){h(this,t),this.GOManager=e,this.tweens={},this.effects={},this.setGO(i,n);}return u(t,[{key:"scene",get:function(){return this.GOManager.scene}},{key:"timeScale",get:function(){return this.GOManager.timeScale}},{key:"destroy",value:function(){this.freeGO(),this.GOManager=void 0;}},{key:"freeGO",value:function(){return this.freeTweens(),this.gameObject.destroy(),this.gameObject=void 0,this}},{key:"setGO",value:function(t,e){return t.setName(e),this.gameObject=t,this.name=e,this.freeTweens(),this}},{key:"setTimeScale",value:function(t){var e=this.tweens;for(var i in e){var n=e[i];n&&(n.timeScale=t);}return this}}]),t}();Object.assign(mr.prototype,gr,yr,{hasData:function(t){var e=this.gameObject;return !!e.data&&e.data.has(t)},getData:function(t){return this.gameObject.getData(t)},setData:function(t,e){return this.gameObject.setData(t,e),this}});var kr=function(t){for(var e in t)return !1;return !0},br=function(t,e){if(!t)return !1;if(t.hasOwnProperty(e))return !0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return !0;t=t.__proto__;}return !1},xr=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Cr=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,n=e.length;i<n;i++)t[e[i]]=null;return t},t.on("destroy",t.clearAllEffects,t)),t._effectSwitchNames.push(e);},wr=function(t,e,i){if(br(t,e))return t;var n=xr(t);if(!n)return t;var s,r="_".concat(e,"Effect");return Object.defineProperty(t,e,{get:function(){return s},set:function(o){s!==o&&(null===(s=o)||!1===s?t[r]&&(n.remove(t[r]),t[r]=void 0):(t[r]||(t[r]=n.addColorMatrix()),t[r][e](1===i?o:void 0)));}}),t[e]=null,Cr(t,e),t},Sr={barrel:function(t){if(br(t,"barrel"))return t;var e,i=xr(t);return i?(Object.defineProperty(t,"barrel",{get:function(){return e},set:function(n){e!==n&&(null===(e=n)||!1===e?t._barrelEffect&&(i.remove(t._barrelEffect),t._barrelEffect=void 0):(t._barrelEffect||(t._barrelEffect=i.addBarrel()),t._barrelEffect.amount=e));}}),t.barrel=null,Cr(t,"barrel"),t):t},blackWhite:function(t){return wr(t,"blackWhite"),t},bloom:function(t){if(br(t,"bloomColor"))return t;var e=xr(t);if(!e)return t;var i,n=1,s=1,r=1,o=1,a=4;return Object.defineProperty(t,"bloomColor",{get:function(){return i},set:function(h){i!==h&&(null===(i=h)||!1===i?t._bloom&&(e.remove(t._bloom),t._bloom=void 0,e.setPadding(0)):(t._bloom||(t._bloom=e.addBloom(i,n,s,r,o,a),e.setPadding(Math.max(n,s)+1)),t._bloom.color=i));}}),Object.defineProperty(t,"bloomOffsetX",{get:function(){return n},set:function(i){if(n!==i&&(n=i,t._bloom)){var r=Math.max(n,s);e.setPadding(r+1),t._bloom.offsetX=n;}}}),Object.defineProperty(t,"bloomOffsetY",{get:function(){return s},set:function(i){if(s!==i&&(s=i,t._bloom)){var r=Math.max(n,s);e.setPadding(r+1),t._bloom.offsetY=s;}}}),Object.defineProperty(t,"bloomBlurStrength",{get:function(){return r},set:function(e){r!==e&&(r=e,t._bloom&&(t._bloom.blurStrength=r));}}),Object.defineProperty(t,"bloomStrength",{get:function(){return o},set:function(e){o!==e&&(o=e,t._bloom&&(t._bloom.strength=o));}}),Object.defineProperty(t,"bloomSteps",{get:function(){return a},set:function(e){a!==e&&(a=e,t._bloom&&(t._bloom.steps=a));}}),t.bloomColor=null,Cr(t,"bloomColor"),t},blur:function(t){if(br(t,"blurColor"))return t;var e=xr(t);if(!e)return t;var i,n=0,s=1,r=1,o=1,a=4;return Object.defineProperty(t,"blurColor",{get:function(){return i},set:function(h){i!==h&&(null===(i=h)||!1===i?t._blur&&(e.remove(t._blur),t._blur=void 0,e.setPadding(0)):(t._blur||(t._blur=e.addBlur(n,s,r,o,i,a),e.setPadding(Math.max(s,r)+1)),t._blur.color=i));}}),Object.defineProperty(t,"blurQuality",{get:function(){return n},set:function(e){n!==e&&(n=e,t._blur&&(t._blur.quality=n));}}),Object.defineProperty(t,"blurX",{get:function(){return s},set:function(i){if(s!==i&&(s=i,t._blur)){var n=Math.max(s,r);e.setPadding(n+1),t._blur.x=s;}}}),Object.defineProperty(t,"blurY",{get:function(){return r},set:function(i){if(r!==i&&(r=i,t._blur)){var n=Math.max(s,r);e.setPadding(n+1),t._blur.y=r;}}}),Object.defineProperty(t,"blurStrength",{get:function(){return o},set:function(e){o!==e&&(o=e,t._blur&&(t._blur.strength=o));}}),Object.defineProperty(t,"blurSteps",{get:function(){return a},set:function(e){a!==e&&(a=e,t._blur&&(t._blur.steps=a));}}),t.blurColor=null,Cr(t,"blurColor"),t},bokeh:function(t){if(br(t,"bokehRadius"))return t;var e=xr(t);if(!e)return t;var i,n=1,s=.2;return Object.defineProperty(t,"bokehRadius",{get:function(){return i},set:function(r){i!==r&&(null===(i=r)||!1===i?t._bokeh&&(e.remove(t._bokeh),t._bokeh=void 0):(t._bokeh||(t._bokeh=e.addBokeh(i,n,s)),t._bokeh.radius=i));}}),Object.defineProperty(t,"bokehAmount",{get:function(){return n},set:function(e){n!==e&&(n=e,t._bokeh&&(t._bokeh.amount=n));}}),Object.defineProperty(t,"bokehContrast",{get:function(){return s},set:function(e){s!==e&&(s=e,t._bokeh&&(t._bokeh.contrast=s));}}),t.bokehRadius=null,Cr(t,"bokehRadius"),t},brightness:function(t){return wr(t,"brightness",1),t},brown:function(t){return wr(t,"brown"),t},circle:function(t){if(br(t,"circleColor"))return t;var e=xr(t);if(!e)return t;var i,n=8,s=0,r=.4,o=1,a=.005;return Object.defineProperty(t,"circleColor",{get:function(){return i},set:function(h){i!==h&&(null===(i=h)||!1===i?t._circle&&(e.remove(t._circle),t._circle=void 0):(t._circle||(t._circle=e.addCircle(n,i,s,o,a),t.circleBackgroundAlpha=r),t._circle.color=i));}}),Object.defineProperty(t,"circleThickness",{get:function(){return n},set:function(e){n!==e&&(n=e,t._circle&&(t._circle.thickness=n));}}),Object.defineProperty(t,"circleBackgroundColor",{get:function(){return s},set:function(e){s!==e&&(s=e,t._circle&&(t._circle.backgroundColor=s));}}),Object.defineProperty(t,"circleBackgroundAlpha",{get:function(){return r},set:function(e){r!==e&&(r=e,t._circle&&(t._circle.glcolor2[3]=r));}}),Object.defineProperty(t,"circleScale",{get:function(){return o},set:function(e){o!==e&&(o=e,t._circle&&(t._circle.scale=o));}}),Object.defineProperty(t,"circleFeather",{get:function(){return a},set:function(e){a!==e&&(a=e,t._circle&&(t._circle.feather=a));}}),t.circleColor=null,Cr(t,"circleColor"),t},contrast:function(t){return wr(t,"contrast",1),t},desaturate:function(t){return wr(t,"desaturate",1),t},desaturateLuminance:function(t){return wr(t,"desaturateLuminance"),t},displacement:function(t){if(br(t,"displacementKey"))return t;var e=xr(t);if(!e)return t;var i,n=.005,s=.005;return Object.defineProperty(t,"displacementKey",{get:function(){return i},set:function(r){i!==r&&(null===(i=r)||!1===i?t._displacement&&(e.remove(t._displacement),t._displacement=void 0):(t._displacement||(t._displacement=e.addDisplacement(i,n,s)),t._displacement.setTexture(i)));}}),Object.defineProperty(t,"displacementX",{get:function(){return n},set:function(e){n!==e&&(n=e,t._displacement&&(t._displacement.x=n));}}),Object.defineProperty(t,"displacementY",{get:function(){return s},set:function(e){s!==e&&(s=e,t._displacement&&(t._displacement.y=s));}}),t.displacementKey=null,Cr(t,"displacementKey"),t},glow:function(t){if(br(t,"glowColor"))return t;var e=xr(t);if(!e)return t;var i,n=4,s=0;return Object.defineProperty(t,"glowColor",{get:function(){return i},set:function(r){i!==r&&(null===(i=r)||!1===i?t._glow&&(e.remove(t._glow),t._glow=void 0,e.setPadding(0)):(t._glow||(t._glow=e.addGlow(i,n,s),e.setPadding(n+1)),t._glow.color=i));}}),Object.defineProperty(t,"glowOuterStrength",{get:function(){return n},set:function(i){n!==i&&(n=i,t._glow&&(e.setPadding(n+1),t._glow.outerStrength=n));}}),Object.defineProperty(t,"glowInnerStrength",{get:function(){return s},set:function(e){s!==e&&(s=e,t._glow&&(t._glow.innerStrength=s));}}),t.glowColor=null,Cr(t,"glowColor"),t},gradient:function(t){if(br(t,"gradientColor"))return t;var e=xr(t);if(!e)return t;var i,n,s=.5,r=0,o=0,a=0,h=1,l=0;return Object.defineProperty(t,"gradientColor",{get:function(){return [i,n]},set:function(u){var c,d;null===u||!1===u?(c=null,d=null):(c=u[0],d=u[1]),i===c&&n===d||(n=d,null===(i=c)||!1===i?t._gradient&&(e.remove(t._gradient),t._gradient=void 0):(t._gradient||(t._gradient=e.addGradient(i,n,s,r,o,a,h,l)),t._gradient.color1=i,t._gradient.color2=n));}}),Object.defineProperty(t,"gradientColor1",{get:function(){return i},set:function(e){null!==e&&!1!==e?i!==e&&(i=e,t._gradient&&(t._gradient.color1=i)):t.gradientColor=e;}}),Object.defineProperty(t,"gradientColor2",{get:function(){return n},set:function(e){null!==e&&!1!==e?n!==e&&(n=e,t._gradient&&(t._gradient.color2=n)):t.gradientColor=e;}}),Object.defineProperty(t,"gradientAlpha",{get:function(){return s},set:function(e){s!==e&&(s=e,t._gradient&&(t._gradient.alpha=s));}}),Object.defineProperty(t,"gradientFromX",{get:function(){return r},set:function(e){r!==e&&(r=e,t._gradient&&(t._gradient.fromX=r));}}),Object.defineProperty(t,"gradientFromY",{get:function(){return o},set:function(e){o!==e&&(o=e,t._gradient&&(t._gradient.fromY=o));}}),Object.defineProperty(t,"gradientToX",{get:function(){return a},set:function(e){a!==e&&(a=e,t._gradient&&(t._gradient.toX=a));}}),Object.defineProperty(t,"gradientToY",{get:function(){return h},set:function(e){h!==e&&(h=e,t._gradient&&(t._gradient.toY=h));}}),Object.defineProperty(t,"gradientSize",{get:function(){return l},set:function(e){l!==e&&(l=e,t._gradient&&(t._gradient.size=l));}}),t.gradientColor=null,Cr(t,"gradientColor"),t},grayscale:function(t){return wr(t,"grayscale",1),t},hue:function(t){return wr(t,"hue",1),t},kodachrome:function(t){return wr(t,"kodachrome"),t},lsd:function(t){return wr(t,"lsd"),t},negative:function(t){return wr(t,"negative"),t},pixelate:function(t){if(br(t,"pixelate"))return t;var e,i=xr(t);return i?(Object.defineProperty(t,"pixelate",{get:function(){return e},set:function(n){e!==n&&(null===(e=n)||!1===e?t._pixelateEffect&&(i.remove(t._pixelateEffect),t._pixelateEffect=void 0):(t._pixelateEffect||(t._pixelateEffect=i.addPixelate()),t._pixelateEffect.amount=e));}}),t.pixelate=null,Cr(t,"pixelate"),t):t},polaroid:function(t){return wr(t,"polaroid"),t},reveal:function(t){if(br(t,"revealLeft"))return t;var e=xr(t);if(!e)return t;var i,n,s,r,o=.1,a=function(){i=null,n=null,s=null,r=null;},h=function(t){t._revealEffect&&(e.remove(t._revealEffect),t._revealEffect=void 0);};return Object.defineProperty(t,"revealLeft",{get:function(){return i},set:function(n){i!==n&&(a(),null===(i=n)||!1===i?h(t):(t._revealEffect||(t._revealEffect=e.addReveal(o,0,0)),t._revealEffect.direction=1,t._revealEffect.axis=0,t._revealEffect.progress=i));}}),Object.defineProperty(t,"revealRight",{get:function(){return n},set:function(i){n!==i&&(a(),null===(n=i)||!1===n?h(t):(t._revealEffect||(t._revealEffect=e.addReveal(o,0,0)),t._revealEffect.direction=0,t._revealEffect.axis=0,t._revealEffect.progress=n));}}),Object.defineProperty(t,"revealUp",{get:function(){return s},set:function(i){s!==i&&(a(),null===(s=i)||!1===s?h(t):(t._revealEffect||(t._revealEffect=e.addReveal(o,0,0)),t._revealEffect.direction=1,t._revealEffect.axis=1,t._revealEffect.progress=s));}}),Object.defineProperty(t,"revealDown",{get:function(){return r},set:function(i){r!==i&&(a(),null===(r=i)||!1===r?h(t):(t._revealEffect||(t._revealEffect=e.addReveal(o,0,0)),t._revealEffect.direction=0,t._revealEffect.axis=1,t._revealEffect.progress=r));}}),Object.defineProperty(t,"revealWidth",{get:function(){return o},set:function(e){o!==e&&(o=e,t._revealEffect&&(t._revealEffect.wipeWidth=o));}}),t.revealLeft=null,Cr(t,"revealLeft"),Cr(t,"revealRight"),Cr(t,"revealUp"),Cr(t,"revealDown"),t},saturate:function(t){return wr(t,"saturate",1),t},sepia:function(t){return wr(t,"sepia"),t},shadow:function(t){if(br(t,"shadowColor"))return t;var e=xr(t);if(!e)return t;var i,n=0,s=0,r=.1,o=1,a=6,h=1;return Object.defineProperty(t,"shadowColor",{get:function(){return i},set:function(l){i!==l&&(null===(i=l)||!1===i?t._shadow&&(e.remove(t._shadow),t._shadow=void 0):(t._shadow||(t._shadow=e.addShadow(n,s,r,o,i,a,h)),t._shadow.color=i));}}),Object.defineProperty(t,"shadowX",{get:function(){return n},set:function(e){n!==e&&(n=e,t._shadow&&(t._shadow.x=n));}}),Object.defineProperty(t,"shadowY",{get:function(){return s},set:function(e){s!==e&&(s=e,t._shadow&&(t._shadow.y=s));}}),Object.defineProperty(t,"decay",{get:function(){return r},set:function(e){r!==e&&(r=e,t._shadow&&(t._shadow.decay=r));}}),Object.defineProperty(t,"shadowPower",{get:function(){return o},set:function(e){o!==e&&(o=e,t._shadow&&(t._shadow.power=o));}}),Object.defineProperty(t,"shadowSamples",{get:function(){return a},set:function(e){a!==e&&(a=e,t._shadow&&(t._shadow.samples=a));}}),Object.defineProperty(t,"shadowIntensity",{get:function(){return h},set:function(e){h!==e&&(h=e,t._shadow&&(t._shadow.intensity=h));}}),t.shadowColor=null,Cr(t,"shadowColor"),t},shiftToBGR:function(t){return wr(t,"shiftToBGR"),t},shine:function(t){if(br(t,"shineSpeed"))return t;var e=xr(t);if(!e)return t;var i,n=.5,s=3;return Object.defineProperty(t,"shineSpeed",{get:function(){return i},set:function(r){i!==r&&(null===(i=r)||!1===i?t._shine&&(e.remove(t._shine),t._shine=void 0):(t._shine||(t._shine=e.addShine(i,n,s)),t._shine.speed=i));}}),Object.defineProperty(t,"shineLineWidth",{get:function(){return n},set:function(e){n!==e&&(n=e,t._shine&&(t._shine.lineWidth=n));}}),Object.defineProperty(t,"shineGradient",{get:function(){return s},set:function(e){s!==e&&(s=e,t._shine&&(t._shine.gradient=s));}}),t.shineSpeed=null,Cr(t,"shineSpeed"),t},technicolor:function(t){return wr(t,"technicolor"),t},tiltShift:function(t){if(br(t,"tiltShiftRadius"))return t;var e=xr(t);if(!e)return t;var i,n=1,s=.2,r=1,o=1,a=1;return Object.defineProperty(t,"tiltShiftRadius",{get:function(){return i},set:function(h){i!==h&&(null===(i=h)||!1===i?t._tiltShift&&(e.remove(t._tiltShift),t._tiltShift=void 0):(t._tiltShift||(t._tiltShift=e.addTiltShift(i,n,s,r,o,a)),t._tiltShift.radius=i));}}),Object.defineProperty(t,"tiltShiftAmount",{get:function(){return n},set:function(e){n!==e&&(n=e,t._tiltShift&&(t._tiltShift.amount=n));}}),Object.defineProperty(t,"tiltShiftContrast",{get:function(){return s},set:function(e){s!==e&&(s=e,t._tiltShift&&(t._tiltShift.contrast=s));}}),Object.defineProperty(t,"tiltShiftBlurX",{get:function(){return r},set:function(e){r!==e&&(r=e,t._tiltShift&&(t._tiltShift.blurX=r));}}),Object.defineProperty(t,"tiltShiftBlurY",{get:function(){return o},set:function(e){o!==e&&(o=e,t._tiltShift&&(t._tiltShift.blurY=o));}}),Object.defineProperty(t,"tiltShiftStrength",{get:function(){return a},set:function(e){a!==e&&(a=e,t._tiltShift&&(t._tiltShift.strength=a));}}),t.tiltShiftRadius=null,Cr(t,"tiltShiftRadius"),t},vignette:function(t){if(br(t,"vignetteColor"))return t;var e=xr(t);if(!e)return t;var i,n=.5,s=.5,r=.5;return Object.defineProperty(t,"vignetteRadius",{get:function(){return i},set:function(o){i!==o&&(null===(i=o)||!1===i?t._vignette&&(e.remove(t._vignette),t._vignette=void 0):(t._vignette||(t._vignette=e.addVignette(n,s,i,r)),t._vignette.radius=i));}}),Object.defineProperty(t,"vignetteX",{get:function(){return n},set:function(e){n!==e&&(n=e,t._vignette&&(t._vignette.x=n));}}),Object.defineProperty(t,"vignetteY",{get:function(){return s},set:function(e){s!==e&&(s=e,t._vignette&&(t._vignette.y=s));}}),Object.defineProperty(t,"vignetteStrength",{get:function(){return r},set:function(e){r!==e&&(r=e,t._vignette&&(t._vignette.strength=r));}}),t.vignetteRadius=null,Cr(t,"vignetteRadius"),t},vintagePinhole:function(t){return wr(t,"vintagePinhole"),t},wipe:function(t){if(br(t,"wipeLeft"))return t;var e=xr(t);if(!e)return t;var i,n,s,r,o=.1,a=function(){i=null,n=null,s=null,r=null;},h=function(t){t._wipeEffect&&(e.remove(t._wipeEffect),t._wipeEffect=void 0);};return Object.defineProperty(t,"wipeLeft",{get:function(){return i},set:function(n){i!==n&&(a(),null===(i=n)||!1===i?h(t):(t._wipeEffect||(t._wipeEffect=e.addWipe(o,0,0)),t._wipeEffect.direction=1,t._wipeEffect.axis=0,t._wipeEffect.progress=i));}}),Object.defineProperty(t,"wipeRight",{get:function(){return n},set:function(i){n!==i&&(a(),null===(n=i)||!1===n?h(t):(t._wipeEffect||(t._wipeEffect=e.addWipe(o,0,0)),t._wipeEffect.direction=0,t._wipeEffect.axis=0,t._wipeEffect.progress=n));}}),Object.defineProperty(t,"wipeUp",{get:function(){return s},set:function(i){s!==i&&(a(),null===(s=i)||!1===s?h(t):(t._wipeEffect||(t._wipeEffect=e.addWipe(o,0,0)),t._wipeEffect.direction=1,t._wipeEffect.axis=1,t._wipeEffect.progress=s));}}),Object.defineProperty(t,"wipeDown",{get:function(){return r},set:function(i){r!==i&&(a(),null===(r=i)||!1===r?h(t):(t._wipeEffect||(t._wipeEffect=e.addWipe(o,0,0)),t._wipeEffect.direction=0,t._wipeEffect.axis=1,t._wipeEffect.progress=r));}}),Object.defineProperty(t,"wipeWidth",{get:function(){return o},set:function(e){o!==e&&(o=e,t._wipeEffect&&(t._wipeEffect.wipeWidth=o));}}),t.wipeLeft=null,Cr(t,"wipeLeft"),Cr(t,"wipeRight"),Cr(t,"wipeUp"),Cr(t,"wipeDown"),t}},Pr=function(t,e){if(void 0===e)e=!0;else if("string"==typeof e)e={config:!0};else if(Array.isArray(e))for(var i=e,n=(e={},0),s=i.length;n<s;n++)e[i[n]]=!0;if(!0===e)for(var r in Sr)Sr[r](t);else for(var r in e)e[r]&&Sr[r]&&Sr[r](t);return t},Tr={tint:0,alpha:1,revealUp:2,revealDown:3,revealLeft:4,revealRight:5},Or={setGOFadeMode:function(t){return "string"==typeof t&&(t=Tr[t]),this.fadeMode=t,this},setGOFadeTime:function(t){return this.fadeTime=t,this},useTintFadeEffect:function(t){return (void 0===this.fadeMode||0===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setTint},useAlphaFadeEffect:function(t){return (void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect:function(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob:function(t,e,i,n){var s=t.gameObject;if(this.useTintFadeEffect(s))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty("tintGray",Math.floor(255*i),this.fadeTime,"Linear",0,!1,n);else if(this.useAlphaFadeEffect(s))void 0!==e&&t.setProperty("alpha",e),t.easeProperty("alpha",i,this.fadeTime,"Linear",0,!1,n);else if(this.useRevealEffect(s)){var r;switch(Pr(s,"reveal"),this.fadeMode){case 2:r="revealUp";break;case 3:r="revealDown";break;case 4:r="revealLeft";break;case 5:r="revealRight";}void 0===e&&(e=0),s[r]=e,t.easeProperty(r,i,this.fadeTime,"Linear",0,!1,n),t.getTweenTask(r).once("complete",(function(){s[r]=null;}));}else n&&n(s);return this}},Mr=function(t){return t>>16&255},Er=function(t){return t>>8&255},_r=function(t){return 255&t},Rr=Phaser.Events.EventEmitter,Lr=function(t,e,i,n,s,r){return void 0===r?r={}:!0===r&&(r=Br),"number"!=typeof i&&(i=0,n=0),r.x=s.x+s.width*t+i,r.y=s.y+s.height*e+n,r},Br={},Dr=function(t,e,i,n,s,r,o){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(o=i,i=void 0),"function"==typeof s&&(o=s,s=void 0),void 0===i&&(i=.5),void 0===n&&(n=.5),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=Lr),function(t){if(t.events)return t;var e=new Rr,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(n){i!==n&&(i=n,e.emit("update",t));}});var n=t.y;Object.defineProperty(t,"y",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t));}});var s=t.width;Object.defineProperty(t,"width",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t));}});var r=t.height;Object.defineProperty(t,"height",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t));}}),t.events=e;}(e);var a=e.events;t.vp=e;var h=function(){o(i,n,s,r,e,t);};a.on("update",h),t.once("destroy",(function(){a.off("update",h),t.vp=void 0;})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h());}}),Object.defineProperty(t,"vpy",{get:function(){return n},set:function(t){n!==t&&(n=t,h());}}),Object.defineProperty(t,"vpxOffset",{get:function(){return s},set:function(t){s!==t&&(s=t,h());}}),Object.defineProperty(t,"vpyOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h());}}),h();},Ir=Phaser.Utils.Array.Remove,jr={has:function(t){return this.bobs.hasOwnProperty(t)},exists:function(t){return this.bobs.hasOwnProperty(t)},get:function(t){return this.bobs[t]},getGO:function(t){var e=this.get(t);return e?e.gameObject:null},addGO:function(t,e){this.remove(t,!0),this.useTintFadeEffect(e)&&function(t,e){if(t.hasOwnProperty("tintR"))return t;void 0===e&&(e=16777215);var i=Mr(e),n=Er(e),s=_r(e);Object.defineProperty(t,"tint",{get:function(){return e},set:function(r){r=16777215&Math.floor(r),t.setTint&&t.setTint(r),e!==r&&(i=Mr(e=r),n=Er(e),s=_r(e));}}),Object.defineProperty(t,"tintR",{get:function(){return i},set:function(n){n=255&Math.floor(n),i!==n&&(i=n,t.tint=(255&n)<<16|65535&e);}}),Object.defineProperty(t,"tintG",{get:function(){return n},set:function(i){i=255&Math.floor(i),n!==i&&(n=i,t.tint=(255&i)<<8|16711935&e);}}),Object.defineProperty(t,"tintB",{get:function(){return s},set:function(i){i=255&Math.floor(i),s!==i&&(s=i,t.tint=255&i|16776960&e);}}),Object.defineProperty(t,"tintGray",{get:function(){return Math.floor((i+n+s)/3)},set:function(e){e=255&Math.floor(e),i===e&&n===e&&s===e||(i=e,n=e,s=e,t.tint=(255&e)<<16|(255&e)<<8|255&e);}}),t.tint=e;}(e),this.viewportCoordinateEnable&&Dr(e,this.viewport),this.effectPropertiesConfig&&Pr(e,this.effectPropertiesConfig),e.once("destroy",(function(){Ir(this.removedGOs,e),this.isEmpty&&this.emit("empty");}),this);var i=new this.BobClass(this,e,t);return this.bobs[t]=i,this},add:function(t){for(var e=this.createGameObjectCallback,i=this.createGameObjectScope,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];var o=e.call.apply(e,[i,this.scene].concat(s));this.addGO(t,o);var a=this.get(t);return this.fadeBob(a,0,1),this},forEachGO:function(t,e){for(var i in this.bobs){var n=this.bobs[i].gameObject;if(e?t.call(e,n,i,this):t(n,i,this))break}return this}},zr={remove:function(t,e){if(!this.has(t))return this;var i=this.get(t);return delete this.bobs[t],this.removedGOs.push(i.gameObject),e?i.destroy():this.fadeBob(i,void 0,0,(function(){i.destroy();})),this},removeAll:function(){var t=this.bobs;for(var e in t)this.remove(e);return this},clear:function(t){void 0===t&&(t=!0);var e=this.bobs;for(var i in e)t&&e[i].destroy(),delete e[i];return this.removedGOs.length=0,this}},Ar={hasProperty:function(t,e){return !!this.has(t)&&this.get(t).hasProperty(e)},getProperty:function(t,e){if(this.has(t))return this.get(t).getProperty(e)},isNumberProperty:function(t,e){return "number"==typeof this.getProperty(t,e)},setProperty:function(t,e,i){return this.has(t)?(this.symbols&&"string"==typeof i&&this.isNumberProperty(t,e)&&(i in this.symbols?i=this.symbols[i]:console.warn("Can't find symbol ".concat(i))),this.get(t).setProperty(e,i),this):this},easeProperty:function(t,e,i,n,s,r,o,a){return this.has(t)?(void 0===n&&(n=1e3),void 0===s&&(s="Linear"),void 0===r&&(r=0),void 0===o&&(o=!1),this.symbols&&"string"==typeof i&&this.isNumberProperty(t,e)&&(i in this.symbols?i=this.symbols[i]:console.warn("Can't find symbol ".concat(i))),this.get(t).easeProperty(e,i,n,s,r,o,a),this):this},hasTweenTask:function(t,e){return !!this.has(t)&&this.get(t).tweens.hasOwnProperty(e)},getTweenTask:function(t,e){if(!this.has(t))return null;var i=this.get(t).tweens[e];return i||null}},Fr={hasMethod:function(t,e){return !!this.has(t)&&this.get(t).hasMethod(e)},call:function(t,e){var i;if(!this.has(t))return this;for(var n=arguments.length,s=new Array(n>2?n-2:0),r=2;r<n;r++)s[r-2]=arguments[r];return (i=this.get(t)).call.apply(i,[e].concat(s)),this}},Wr={hasData:function(t,e){return !!this.has(t)&&this.get(t).hasData(e)},getData:function(t,e){if(this.has(t))return this.get(t).getData(e)},setData:function(t,e,i){return this.has(t)?(this.get(t).setData(e,i),this):this}},Vr=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Yr=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height},Gr=Phaser.Geom.Rectangle,Xr=Phaser.Math.Vector2,Hr=Phaser.Math.RotateAround,Ur=function(t,e){if(void 0===e?e=new Gr:!0===e&&(void 0===Nr&&(Nr=new Gr),e=Nr),t.getBounds)return t.getBounds(e);var i,n,s,r,o,a,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();Kr(t,e),u.transformPoint(e.x,e.y,e),i=e.x,n=e.y,Jr(t,e),u.transformPoint(e.x,e.y,e),s=e.x,r=e.y,qr(t,e),u.transformPoint(e.x,e.y,e),o=e.x,a=e.y,Zr(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y;}else Kr(t,e),i=e.x,n=e.y,Jr(t,e),s=e.x,r=e.y,qr(t,e),o=e.x,a=e.y,Zr(t,e),h=e.x,l=e.y;return e.x=Math.min(i,s,o,h),e.y=Math.min(n,r,a,l),e.width=Math.max(i,s,o,h)-e.x,e.height=Math.max(n,r,a,l)-e.y,e},Nr=void 0,Kr=function(t,e,i){return void 0===e?e=new Xr:!0===e&&(void 0===$r&&($r=new Xr),e=$r),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-Vr(t)*t.originX,e.y=t.y-Yr(t)*t.originY,Qr(t,e,i))},Jr=function(t,e,i){return void 0===e?e=new Xr:!0===e&&(void 0===$r&&($r=new Xr),e=$r),t.getTopRight?t.getTopRight(e):(e.x=t.x-Vr(t)*t.originX+Vr(t),e.y=t.y-Yr(t)*t.originY,Qr(t,e,i))},qr=function(t,e,i){return void 0===e?e=new Xr:!0===e&&(void 0===$r&&($r=new Xr),e=$r),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-Vr(t)*t.originX,e.y=t.y-Yr(t)*t.originY+Yr(t),Qr(t,e,i))},Zr=function(t,e,i){return void 0===e?e=new Xr:!0===e&&(void 0===$r&&($r=new Xr),e=$r),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-Vr(t)*t.originX+Vr(t),e.y=t.y-Yr(t)*t.originY+Yr(t),Qr(t,e,i))},$r=void 0,Qr=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Hr(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e},to=Phaser.Utils.Objects.GetValue,eo=function(t,e,i){var n,s,r,o,a;if("number"==typeof i?n=i:(n=to(i,"color"),s=to(i,"lineWidth"),r=to(i,"fillColor"),o=to(i,"fillAlpha",1),a=to(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h<l;h++)io(t[h],e,n,s,r,o,a);else io(t,e,n,s,r,o,a);},io=function(t,e,i,n,s,r,o){if(t.getBounds||void 0!==t.width&&void 0!==t.height){void 0===i&&(i=16777215),void 0===n&&(n=1),void 0===s&&(s=null),void 0===r&&(r=1),void 0===o&&(o=0);var a=Kr(t,no[0]);a.x-=o,a.y-=o;var h=Jr(t,no[1]);h.x+=o,h.y-=o;var l=Zr(t,no[2]);l.x+=o,l.y+=o;var u=qr(t,no[3]);u.x-=o,u.y+=o,null!==s&&e.fillStyle(s,r).fillPoints(no,!0,!0),null!==i&&e.lineStyle(n,i).strokePoints(no,!0,!0);}},no=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],so={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):eo(i,t,e);})),this}};Object.assign(so,Or,jr,zr,Ar,Fr,Wr);var ro=Phaser.Cameras.Scene2D.BaseCamera,oo=Phaser.Geom.Rectangle,ao=function(t,e,i){return e instanceof ro||(i=e,e=void 0),void 0===i?i=new oo:!0===i&&(i=ho),e?t.scale.getViewPort(e,i):t.scale.getViewPort(i)},ho=new oo,lo=Phaser.Utils.Objects.GetValue,uo=function(){function t(e,i){h(this,t),this.scene=e,this.BobClass=lo(i,"BobClass",mr),this.setCreateGameObjectCallback(lo(i,"createGameObject"),lo(i,"createGameObjectScope")),this.setEventEmitter(lo(i,"eventEmitter",void 0));var n=lo(i,"fade",500);"number"==typeof n?(this.setGOFadeMode(),this.setGOFadeTime(n)):(this.setGOFadeMode(lo(n,"mode")),this.setGOFadeTime(lo(n,"time",500)));var s=lo(i,"viewportCoordinate",!1);!1!==s?(this.setViewportCoordinateEnable(lo(i,"enable",!0)),this.setViewport(lo(s,"viewport"))):this.setViewportCoordinateEnable(!1);var r=lo(i,"effectProperties",!1);this.setEffectPropertiesConfig(r),this.setSymbols(lo(i,"symbols")),this.bobs={},this.removedGOs=[],this._timeScale=1;}return u(t,[{key:"destroy",value:function(t){this.clear(!t),this.createGameObjectCallback=void 0,this.viewport=void 0,this.scene=void 0;}},{key:"timeScale",get:function(){return this._timeScale},set:function(t){if(this._timeScale!==t){this._timeScale=t;var e=this.bobs;for(var i in e)e[i].setTimeScale(t);}}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"setCreateGameObjectCallback",value:function(t,e){return this.createGameObjectCallback=t,this.createGameObjectScope=e,this}},{key:"setViewportCoordinateEnable",value:function(t){return void 0===t&&(t=!0),this.viewportCoordinateEnable=t,this}},{key:"setEffectPropertiesConfig",value:function(t){return void 0===t&&(t=!0),this.effectPropertiesConfig=t,this}},{key:"setViewport",value:function(t){return void 0===t&&(t=ao(this.scene,this.scene.cameras.main)),this.viewport=t,this}},{key:"setSymbols",value:function(t){return this.symbols=t,this}},{key:"isEmpty",get:function(){return kr(this.bobs)&&0===this.removedGOs.length}}]),t}();Object.assign(uo.prototype,vr,so);var co=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var n=0,s=t.length;n<s;n++){var r=t[n];if(r.displayList?i=r.displayList:r.parentContainer&&(i=r.parentContainer.list),i)break}return i||(i=r.scene.sys.displayList),i.depthSort&&(i.depthSort(),i=i.list),e?t.sort((function(t,e){return i.indexOf(e)-i.indexOf(t)})):t.sort((function(t,e){return i.indexOf(t)-i.indexOf(e)})),t},fo=Phaser.Utils.Objects.GetValue,po=function(e){function i(e,n){var s;h(this,i),void 0===n?n={}:Array.isArray(n)&&(n={layers:n}),n.hasOwnProperty("fade")||(n.fade=0),n.viewportCoordinate=!1,s=t(this,i,[e,n]);var r=fo(n,"layers");if(r)for(var o=0,a=r.length;o<a;o++)s.add(r[o]);return s}return d(i,e),u(i,[{key:"setCreateGameObjectCallback",value:function(t,e){return t||(t=vo),m(f(i.prototype),"setCreateGameObjectCallback",this).call(this,t,e),this}},{key:"addGO",value:function(t,e){return m(f(i.prototype),"addGO",this).call(this,t,e),e.name=t,this}},{key:"getLayer",value:function(t){return this.getGO(t)}},{key:"getLayers",value:function(t){return void 0===t&&(t=[]),this.forEachGO((function(e){t.push(e);})),co(t,!1),t}},{key:"addToLayer",value:function(t,e){var i=this.getGO(t);if(i)return e.isRexContainerLite?e.addToLayer(i):i.add(e),this;console.warn("Can't get layer \"".concat(t,'"'));}},{key:"removeFromLayer",value:function(t,e,i){var n=this.getGO(t);if(n)return void 0===i&&(i=!0),e.isRexContainerLite?e.removeFromLayer(n,i):(n.remove(e),i&&e.addToDisplayList()),this;console.warn("Can't get layer \"".concat(t,'"'));}},{key:"clearLayer",value:function(t,e){void 0===e&&(e=!0);var i=this.getGO(t);if(i){if(e)for(var n=i.getAll(),s=0,r=n.length;s<r;s++)n.destroy();else i.removeAll();return this}console.warn("Can't get layer \"".concat(t,'"'));}}]),i}(uo),vo=function(t,e){var i=t.add.layer();return void 0!==e&&i.setDepth(e),i},go=function(t){return null==t||"object"!==o(t)?null:H(t)?t:t.scene&&H(t.scene)?t.scene:t.parent&&t.parent.scene&&H(t.parent.scene)?t.parent.scene:null},yo=Phaser.Utils.Objects.GetValue,mo=function(){function t(e,i){h(this,t),this.setParent(e),this.isShutdown=!1,this.setEventEmitter(yo(i,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this));}return u(t,[{key:"shutdown",value:function(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0);}},{key:"destroy",value:function(t){this.shutdown(t);}},{key:"onEnvDestroy",value:function(){this.destroy(!0);}},{key:"onParentDestroy",value:function(t,e){this.destroy(e);}},{key:"setParent",value:function(t){return this.parent=t,this.scene=go(t),this.game=U(t),this}}]),t}();Object.assign(mo.prototype,vr);var ko=Phaser.Utils.Objects.GetValue,bo=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n]))._isRunning=!1,s.isPaused=!1,s.tickingState=!1,s.setTickingMode(ko(n,"tickingMode",1)),s}return d(i,e),u(i,[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking();}},{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),m(f(i.prototype),"shutdown",this).call(this,t));}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=xo[t]),this.tickingMode=t;}},{key:"startTicking",value:function(){this.tickingState=!0;}},{key:"stopTicking",value:function(){this.tickingState=!1;}},{key:"isRunning",get:function(){return this._isRunning},set:function(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()));}},{key:"start",value:function(){return this.isPaused=!1,this.isRunning=!0,this}},{key:"pause",value:function(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}},{key:"resume",value:function(){return this.isPaused&&(this.isRunning=!0),this}},{key:"stop",value:function(){return this.isPaused=!1,this.isRunning=!1,this}},{key:"complete",value:function(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this);}}]),i}(mo),xo={no:0,lazy:1,always:2},Co=Phaser.Utils.Objects.GetValue,wo=function(e){function i(e,n){var s;h(this,i);var r=(s=t(this,i,[e,n])).scene?"update":"step";return s.tickEventName=Co(n,"tickEventName",r),s.isSceneTicker=!So(s.tickEventName),s}return d(i,e),u(i,[{key:"startTicking",value:function(){m(f(i.prototype),"startTicking",this).call(this),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this);}},{key:"stopTicking",value:function(){m(f(i.prototype),"stopTicking",this).call(this),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this);}}]),i}(bo),So=function(t){return "step"===t||"poststep"===t},Po=Phaser.Utils.Objects.GetValue,To=Phaser.Math.Clamp,Oo=function(){function t(e){h(this,t),this.resetFromJSON(e);}return u(t,[{key:"resetFromJSON",value:function(t){this.state=Po(t,"state",Mo),this.timeScale=Po(t,"timeScale",1),this.delay=Po(t,"delay",0),this.repeat=Po(t,"repeat",0),this.repeatCounter=Po(t,"repeatCounter",0),this.repeatDelay=Po(t,"repeatDelay",0),this.duration=Po(t,"duration",0),this.nowTime=Po(t,"nowTime",0),this.justRestart=Po(t,"justRestart",!1);}},{key:"toJSON",value:function(){return {state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}},{key:"destroy",value:function(){}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"setDelay",value:function(t){return void 0===t&&(t=0),this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatInfinity",value:function(){return this.repeat=-1,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"start",value:function(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?_o:Eo,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=Mo,this}},{key:"update",value:function(t,e){this.state!==Mo&&this.state!==Lo&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter<this.repeat?(this.repeatCounter++,this.justRestart=!0,this.nowTime-=this.duration,this.repeatDelay>0&&(this.nowTime-=this.repeatDelay,this.state=Ro)):(this.nowTime=this.duration,this.state=Lo):this.nowTime>=0&&(this.state=_o));}},{key:"t",get:function(){var t;switch(this.state){case Mo:case Eo:case Ro:t=0;break;case _o:t=this.nowTime/this.duration;break;case Lo:t=1;}return To(t,0,1)},set:function(t){(t=To(t,-1,1))<0?(this.state=Eo,this.nowTime=-this.delay*t):(this.state=_o,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===Mo}},{key:"isDelay",get:function(){return this.state===Eo}},{key:"isCountDown",get:function(){return this.state===_o}},{key:"isRunning",get:function(){return this.state===Eo||this.state===_o}},{key:"isDone",get:function(){return this.state===Lo}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),Mo=0,Eo=1,_o=2,Ro=3,Lo=-1,Bo=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).timer=new Oo,s}return d(i,e),u(i,[{key:"shutdown",value:function(t){this.isShutdown||(m(f(i.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),m(f(i.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),m(f(i.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),m(f(i.prototype),"complete",this).call(this),this}}]),i}(wo),Do=Phaser.Utils.Objects.GetValue,Io=Phaser.Utils.Objects.GetAdvancedValue,jo=Phaser.Tweens.Builders.GetEaseFunction,zo=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Do(t,"timer")),this.setEnable(Do(t,"enable",!0)),this.setTarget(Do(t,"target",this.parent)),this.setDelay(Io(t,"delay",0)),this.setDuration(Io(t,"duration",1e3)),this.setEase(Do(t,"ease","Linear")),this.setRepeat(Do(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=jo(t),this}},{key:"start",value:function(){return this.timer.isRunning||m(f(i.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),m(f(i.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),i}(Bo),Ao=Phaser.Sound.BaseSound,Fo=function(t){return t instanceof Ao},Wo=Phaser.Utils.Objects.GetValue,Vo=Phaser.Utils.Objects.GetAdvancedValue,Yo=Phaser.Math.Linear,Go=function(e){function i(e,n,s){var r;return h(this,i),Fo(e)&&(s=n,n=e,e=void 0),n.active=!0,n.scene=e,n.game=n.manager.game,(r=t(this,i,[n,s])).volume={},r.resetFromJSON(s),r}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return m(f(i.prototype),"resetFromJSON",this).call(this,t),this.setMode(Wo(t,"mode",0)),this.setEnable(Wo(t,"enable",!0)),this.setVolumeRange(Vo(t,"volume.start",this.parent.volume),Vo(t,"volume.end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Xo[t]),this.mode=t,this}},{key:"setVolumeRange",value:function(t,e){return this.volume.start=t,this.volume.end=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),m(f(i.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){t.volume=Yo(this.volume.start,this.volume.end,e.t);}},{key:"complete",value:function(){switch(m(f(i.prototype),"complete",this).call(this),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy();}return this}}]),i}(zo),Xo={stop:1,destroy:2},Ho=function(t,e,i,n,s){Fo(t)&&(s=n,n=i,i=e,e=t,t=void 0),void 0===n&&(n=1),void 0===s&&(s=0);var r,o={mode:0,volume:{start:s,end:n},duration:i};return "string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(o):(r=new Go(t,e,o),e._fade=r),r.start(),e.isPlaying||e.setVolume(s).play(),e},Uo=function(t,e,i,n){Fo(t)&&(n=i,i=e,e=t,t=void 0),void 0===n&&(n=!0);var s,r={mode:n?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(s=e._fade).stop().resetFromJSON(r):(s=new Go(t,e,r),e._fade=s),s.start(),e.isPlaying||e.play(),e},No=Phaser.Utils.Objects.GetValue,Ko={setBackgroundMusicLoop:function(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime:function(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic:function(){return this.backgroundMusic},setCurrentBackgroundMusic:function(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0);}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0);}),this),t.isPlaying||t.play()),this},playBackgroundMusic:function(t,e){if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:No(e,"loop",this.backgroundMusicLoop),mute:No(e,"mute",this.backgroundMusicMute),volume:No(e,"volume",this.backgroundMusicVolume),detune:No(e,"detune",0),rate:No(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic:function(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic:function(t){return this.backgroundMusic&&Ho(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic:function(t,e){return this.backgroundMusic&&Uo(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic:function(t,e){var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute:function(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume:function(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate:function(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune:function(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}},Jo=Phaser.Utils.Objects.GetValue,qo={setBackgroundMusic2Loop:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime:function(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2:function(){return this.backgroundMusic2},setCurrentBackgroundMusic2:function(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0);}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0);}),this),t.isPlaying||t.play()),this},playBackgroundMusic2:function(t,e){if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:Jo(e,"loop",this.backgroundMusicLoop),mute:Jo(e,"mute",this.backgroundMusic2Mute),volume:Jo(e,"volume",this.backgroundMusic2Volume),detune:Jo(e,"detune",0),rate:Jo(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2:function(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2:function(t){return this.backgroundMusic2&&Ho(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2:function(t,e){return this.backgroundMusic2&&Uo(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2:function(t,e){var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume:function(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}},Zo=Phaser.Utils.Array.Remove,$o=Phaser.Utils.Objects.GetValue,Qo={getSoundEffects:function(){return this.soundEffects},getLastSoundEffect:function(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect:function(t,e){var i=this.sound.add(t,{mute:$o(e,"mute",this.soundEffectsMute),volume:$o(e,"volume",this.soundEffectsVolume),detune:$o(e,"detune",0),rate:$o(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&Zo(this.soundEffects,i);}),this).once("destroy",(function(){this.sound&&Zo(this.soundEffects,i);}),this).play(),this},stopAllSoundEffects:function(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect:function(t){var e=this.getLastSoundEffect();return e&&Ho(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect:function(t,e){var i=this.getLastSoundEffect();return i&&Uo(i,t,e),this},fadeOutAllSoundEffects:function(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)Uo(this.soundEffects[i],t,e);return this},setSoundEffectMute:function(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t);}else this.soundEffectsMute=t;return this},setSoundEffectVolume:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t);}else this.soundEffectsVolume=t;return this},setSoundEffectDetune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,s=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;n<s;n++)i[n].setDetune(t);return this},setSoundEffectRate:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,s=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;n<s;n++)i[n].setRate(t);return this}},ta=Phaser.Utils.Array.Remove,ea=Phaser.Utils.Objects.GetValue,ia={getSoundEffects2:function(){return this.soundEffects2},getLastSoundEffect2:function(){return this.soundEffects2[this.soundEffects2.length-1]},playSoundEffect2:function(t,e){var i=this.sound.add(t,{mute:ea(e,"mute",this.soundEffects2Mute),volume:ea(e,"volume",this.soundEffects2Volume),detune:ea(e,"detune",0),rate:ea(e,"rate",1)});return this.soundEffects2.push(i),i.once("complete",(function(){i.destroy(),this.sound&&ta(this.soundEffects2,i);}),this).once("destroy",(function(){this.sound&&ta(this.soundEffects2,i);}),this).play(),this},stopAllSoundEffects2:function(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect2:function(t){var e=this.getLastSoundEffect2();return e&&Ho(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2:function(t,e){var i=this.getLastSoundEffect2();return i&&Uo(i,t,e),this},fadeOutAllSoundEffects2:function(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)Uo(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute:function(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t);}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t);}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,s=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;n<s;n++)i[n].setDetune(t);return this},setSoundEffect2Rate:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,s=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;n<s;n++)i[n].setRate(t);return this}},na={};Object.assign(na,Ko,qo,Qo,ia);var sa=Phaser.Utils.Objects.GetValue,ra=function(){function t(e,i){h(this,t),this.sound=function(t){return H(t)?t.sys.sound:t.sound}(e),this.backgroundMusic=void 0,this._backgroundMusicVolume=sa(i,"bgm.volume",1),this._backgroundMusicMute=sa(i,"bgm.mute",!1),this.setBackgroundMusicLoop(sa(i,"bgm.loop",!0)),this.setBackgroundMusicFadeTime(sa(i,"bgm.fade",500)),this.backgroundMusic2=void 0,this._backgroundMusic2Volume=sa(i,"bgm2.volume",1),this._backgroundMusic2Mute=sa(i,"bgm2.mute",!1),this.setBackgroundMusic2Loop(sa(i,"bgm2.loop",!0)),this.setBackgroundMusic2FadeTime(sa(i,"bgm2.fade",500)),this.soundEffects=[],this._soundEffectsVolume=sa(i,"soundEffect.volume",1),this.soundEffects2=[],this._soundEffects2Volume=sa(i,"soundEffect2.volume",1);var n=sa(i,"bgm.initial",void 0);n&&this.setCurrentBackgroundMusic(n);var s=sa(i,"bgm2.initial",void 0);s&&this.setCurrentBackgroundMusic2(s);}return u(t,[{key:"destroy",value:function(){if(this.backgroundMusic&&this.backgroundMusic.destroy(),this.backgroundMusic=void 0,this.backgroundMusic2&&this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0,this.soundEffects.length)for(var t=this.soundEffects.length-1;t>=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}},{key:"backgroundMusicMute",get:function(){return this._backgroundMusicMute},set:function(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute);}},{key:"backgroundMusicVolume",get:function(){return this._backgroundMusicVolume},set:function(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t);}},{key:"backgroundMusic2Mute",get:function(){return this._backgroundMusic2Mute},set:function(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute);}},{key:"backgroundMusic2Volume",get:function(){return this._backgroundMusic2Volume},set:function(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t);}},{key:"soundEffectsMute",get:function(){return this._soundEffectsMute},set:function(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,n=e.length;i<n;i++)e[i].setMute(t);}},{key:"soundEffectsVolume",get:function(){return this._soundEffectsVolume},set:function(t){this._soundEffectsVolume=t;for(var e=this.soundEffects,i=0,n=e.length;i<n;i++)e[i].setVolume(t);}},{key:"soundEffects2Mute",get:function(){return this._soundEffects2Mute},set:function(t){this._soundEffects2Mute=t;for(var e=this.soundEffects,i=0,n=soundEffects2.length;i<n;i++)e[i].setMute(t);}},{key:"soundEffects2Volume",get:function(){return this._soundEffects2Volume},set:function(t){this._soundEffects2Volume=t;for(var e=this.soundEffects2,i=0,n=e.length;i<n;i++)e[i].setVolume(t);}}]),t}();Object.assign(ra.prototype,na);var oa=Phaser.Utils.Objects.GetValue,aa=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"startTicking",value:function(){m(f(i.prototype),"startTicking",this).call(this),this.scene.sys.events.on("update",this.update,this);}},{key:"stopTicking",value:function(){m(f(i.prototype),"stopTicking",this).call(this),this.scene&&this.scene.sys.events.off("update",this.update,this);}},{key:"update",value:function(t,e){return this.isRunning&&0!==this.timeScale?(this.tick(e),this):this}}]),i}(function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.isRunning=oa(t,"isRunning",!1),this.timeScale=oa(t,"timeScale",1),this.now=oa(t,"now",0),this}},{key:"toJSON",value:function(){return {isRunning:this.isRunning,timeScale:this.timeScale,now:this.now,tickingMode:this.tickingMode}}},{key:"start",value:function(t){return void 0===t&&(t=0),this.delta=0,this.now=t,m(f(i.prototype),"start",this).call(this),this}},{key:"seek",value:function(t){return this.now=t,this}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"tick",value:function(t){return t*=this.timeScale,this.now+=t,this.delta=t,this.emit("update",this.now,this.delta),this}}]),i}(bo)),ha=function(t,e){return void 0===e&&(e=.5),t<=e?t/=e:t=1-(t-e)/(1-e),t},la=Phaser.Math.Clamp,ua=function(){function t(e,i){h(this,t),this.setTimeline(e).reset(i);}return u(t,[{key:"setTimeline",value:function(t){return this.timeline=t,this}},{key:"setName",value:function(t){return this.name=t,this}},{key:"setCallbacks",value:function(t,e,i,n){return this.target=t,this.onStart=e,this.onProgress=i,this.onComplete=n,this}},{key:"setDuration",value:function(t,e){return void 0===e&&(e=!1),this.duration=t,this.remainder=t,this.t=0,this.yoyo=e,this}},{key:"setPaused",value:function(t){return this.isPaused=t,this}},{key:"pause",value:function(){return this.isPaused=!0,this}},{key:"resume",value:function(){return this.isPaused=!1,this}},{key:"setRemoved",value:function(t){return this.removed=t,this}},{key:"remove",value:function(){return this.removed=!0,this}},{key:"seek",value:function(t){return this.remainder=this.duration*(1-t),this}},{key:"reset",value:function(t){return this.setName(t.name).setDuration(t.duration,t.yoyo).setCallbacks(t.target,t.onStart,t.onProgress,t.onComplete).setPaused(!1).setRemoved(!1),this}},{key:"onFree",value:function(){this.setTimeline().setCallbacks();}},{key:"getProgress",value:function(){var t=1-this.remainder/this.duration;return t=la(t,0,1),this.yoyo&&(t=ha(t)),t}},{key:"setProgress",value:function(t){t=la(t,0,1),this.remainder=this.duration*(1-t);}},{key:"runCallback",value:function(t){t&&t(this.target,this.t,this);}},{key:"update",value:function(t,e){if(this.removed)return !0;if(this.isPaused)return !1;this.remainder-=e,this.t=this.getProgress(),this.runCallback(this.onProgress);var i=this.remainder<=0;return i&&this.runCallback(this.onComplete),i}}]),t}(),ca=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"allocate",value:function(){return this.pop()}},{key:"free",value:function(t){t.onFree(),this.push(t);}},{key:"freeMultiple",value:function(t){for(var e=0,i=t.length;e<i;e++)this.free(t[e]);return this}}]),i}(at),da=Phaser.Utils.Objects.GetValue,fa=new ca,pa=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).addedTimers=[],s.timers=[],s.timerPool=da(n,"pool",fa),s}return d(i,e),u(i,[{key:"shutdown",value:function(){this.isShutdown||(this.timerPool.freeMultiple(this.addedTimers).freeMultiple(this.timers),this.timerPool=void 0,this.addedTimers=void 0,this.timers=void 0,m(f(i.prototype),"shutdown",this).call(this));}},{key:"addTimer",value:function(t){var e=this.timerPool.allocate();return e?e.setTimeline(this).reset(t):e=new ua(this,t),this.addedTimers.push(e),e.runCallback(e.onStart),this.isRunning||this.start(),e}},{key:"delayCall",value:function(t,e,i,n){return this.addTimer({duration:t,onComplete:function(t,s,r){void 0===i&&(i=[]),i.push(r),e.apply(n,i);}})}},{key:"delayEvent",value:function(t,e){this.removeDelayEvent(e);var i=this.delayCall(t,(function(){this.removeDelayEvent(e),this.emit(e);}),[],this);return this.once("_remove.".concat(e),(function(){i.remove(),i=void 0;})),this}},{key:"removeDelayEvent",value:function(t){return this.emit("_remove.".concat(t)),this}},{key:"getTimers",value:function(t){for(var e=[],i=[this.addedTimers,this.timers],n=0,s=i.length;n<s;n++)for(var r=i[n],o=0,a=r.length;o<a;o++){var h=r[o];h.name===t&&e.push(h);}return e}},{key:"update",value:function(t,e){var n;if(m(f(i.prototype),"update",this).call(this,t,e),this.isRunning){(n=this.timers).push.apply(n,w(this.addedTimers)),this.addedTimers.length=0;for(var s=[],r=0,o=this.timers.length;r<o;r++){var a=this.timers[r];a.update(this.now,this.delta)?this.timerPool.free(a):s.push(a);}this.timers=s,0===this.timers.length&&0===this.addedTimers.length&&this.complete();}}}]),i}(aa),va=function(){function t(e){h(this,t),e||(this.setEventEmitter(!0),e=this),this.parent=e,this.waitId=0,this.waitCompleteEventName="_wait.complete",this.removeWaitEventsEventName="_remove.wait";}return u(t,[{key:"destroy",value:function(){this.removeWaitEvents(),this.clearWaitCompleteCallbacks(),this.parent=null;}},{key:"waitEvent",value:function(t,e,i){var n=this.getWaitCompleteTriggerCallback(i);return t.once(e,n,this),this.parent.once(this.removeWaitEventsEventName,(function(){t.off(e,n,this);})),this.parent}},{key:"getWaitCompleteTriggerCallback",value:function(t){void 0===t&&(t=!0);var e=this.waitId,i=this,n=function(){e<i.waitId||(i.waitId++,i.removeWaitEvents(),i.parent.emit(i.waitCompleteEventName));};if(t){return function(){!function(t,e,i,n,s){var r=go(t);r.time.delayedCall(e,(function(){r.sys.events.once("preupdate",(function(){i.call(n,s);}));}));}(i.parent,0,n);}}return n}},{key:"removeWaitEvents",value:function(){return this.parent.emit(this.removeWaitEventsEventName),this}},{key:"addWaitCompleteCallback",value:function(t,e){return this.parent.on(this.waitCompleteEventName,t,e),this}},{key:"clearWaitCompleteCallbacks",value:function(){return this.parent.off(this.waitCompleteEventName),this}}]),t}();Object.assign(va.prototype,vr);var ga={setClickTarget:function(t){this.clickTarget=t,t?H(t)?this.clickEE=t.input:this.clickEE=t.setInteractive():this.clickEE=null;},waitClick:function(){return this.clickEE?this.waitEvent(this.clickEE,"pointerdown"):this.waitTime(0)},waitKeyDown:function(t){var e,i,n,s,r=this.scene.input.keyboard;if("string"==typeof t){if(-1===t.indexOf("|"))return this.waitEvent(r,"keydown-".concat(t.toUpperCase()));for(var o=0,a=(e=t,n="(?<!\\\\)\\".concat(i="|"),s="\\".concat(i),e.split(new RegExp(n,"g")).map((function(t){return t.replace(s,i)}))).length;o<a;o++)this.waitEvent(r,"keydown-".concat(t.toUpperCase()));return this.parent}return this.waitEvent(r,"keydown")}},ya=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e])).waitCompleteEventName=wt(n,"completeEventName",s.waitCompleteEventName),s.setClickTarget(wt(n,"clickTarget",s.scene)),s.setCameraTarget(wt(n,"camera",s.scene.cameras.main)),s}return d(i,e),u(i,[{key:"clickTarget",get:function(){return this.parent.clickTarget},set:function(t){this.parent.clickTarget=t;}},{key:"cameraTarget",get:function(){return this.parent.cameraTarget},set:function(t){this.parent.cameraTarget=t;}},{key:"destroy",value:function(){this.setClickTarget(),this.setCameraTarget(),m(f(i.prototype),"destroy",this).call(this);}},{key:"scene",get:function(){return this.parent.managersScene}}]),i}(va),ma={waitAny:function(t){if(!t)return this.waitTime(0);var e=!1;for(var i in t)switch(i){case"time":e=!0,this.waitTime(t.time);break;case"click":e=!0,this.waitClick(t.key);break;case"key":e=!0,this.waitKeyDown(t.key);break;case"bgm":e=!0,this.waitBackgroundMusicComplete();break;case"bgm2":e=!0,this.waitBackgroundMusic2Complete();break;case"se":e=!0,this.waitSoundEffectComplete();break;case"se2":e=!0,this.waitSoundEffect2Complete();break;case"camera":e=!0,this.waitCameraEffectComplete("camera.".concat(t.camera.toLowerCase()));break;default:var n=i.split(".");if(2===n.length){var s=n[0],r=n[1],o=this.parent.getGameObjectManager(void 0,s);if(!o)continue;if("destroy"===r)return this.waitGameObjectDestroy(void 0,s);if("number"==typeof o.getProperty(s,r)){e=!0,this.waitGameObjectTweenComplete(void 0,s,r);continue}var a=r,h=a.startsWith("!");h&&(a=a.substring(1)),o.hasData(s,r)&&(e=!0,this.waitGameObjectDataFlag(void 0,s,a,!h));}}return e||this.waitTime(0),this.parent}};Object.assign(ya.prototype,{waitTime:function(t){var e=this.parent.timeline;return e.delayEvent(t,"delay"),this.parent.once(this.removeWaitEventsEventName,(function(){e.removeDelayEvent("delay");})),this.waitEvent(e,"delay")}},ga,{waitGameObjectTweenComplete:function(t,e,i){var n=this.parent.getGameObjectTweenTask(t,e,i);return n?this.waitEvent(n,"complete"):this.waitTime(0)},waitGameObjectDataFlag:function(t,e,i,n){var s=this.parent.getGameObject(t,e);if(!s)return this.waitTime(0);if(s.getData(i)===n)return this.waitTime(0);var r="changedata-".concat(i),o=function(t,e,i){(e=!!e)===n&&t.emit("_dataFlagMatch");};return s.on(r,o),this.parent.once(this.removeWaitEventsEventName,(function(){s.off(r,o);})),this.waitEvent(s,"_dataFlagMatch")},waitGameObjectDestroy:function(t,e){var i=this.parent.getGameObject(t,e);return i?this.waitEvent(i,"destroy"):this.waitTime(0)},waitGameObjectManagerEmpty:function(t){if(t){var e=this.parent.getGameObjectManager(t);return e?this.waitEvent(e,"empty"):this.waitTime(0)}var i=this.parent.gameObjectManagers,n=!1;for(var s in i)n=!0,this.waitEvent(i[s],"empty");return n?this.parent:this.waitTime(0)}},{setCameraTarget:function(t){return this.cameraTarget=t,this},waitCameraEffectComplete:function(t){var e,i,n=this.cameraTarget;if(!n)return this.waitTime(0);switch(t){case"camera.fadein":e=n.fadeEffect,i="camerafadeincomplete";break;case"camera.fadeout":e=n.fadeEffect,i="camerafadeoutcomplete";break;case"camera.flash":e=n.flashEffect,i="cameraflashcomplete";break;case"camera.shake":e=n.shakeEffect,i="camerashakecomplete";break;case"camera.zoom":e=n.zoomEffect,i="camerazoomcomplete";break;case"camera.rotate":e=n.rotateToEffect,i="camerarotatecomplete";break;case"camera.scroll":e=n.panEffect,i="camerapancomplete";}return e.isRunning?this.waitEvent(n,i):this.waitTime(0)}},{waitSoundEffectComplete:function(){if(!this.parent.soundManager)return this.waitTime(0);var t=this.parent.soundManager.getLastSoundEffect();return t?this.waitEvent(t,"complete"):this.waitTime(0)},waitSoundEffect2Complete:function(){if(!this.parent.soundManager)return this.waitTime(0);var t=this.parent.soundManager.getLastSoundEffect2();return t?this.waitEvent(t,"complete"):this.waitTime(0)},waitBackgroundMusicComplete:function(){if(!this.parent.soundManager)return this.waitTime(0);var t=this.parent.soundManager.getBackgroundMusic();return t?this.waitEvent(t,"complete"):this.waitTime(0)},waitBackgroundMusic2Complete:function(){if(!this.parent.soundManager)return this.waitTime(0);var t=this.parent.soundManager.getBackgroundMusic2();return t?this.waitEvent(t,"complete"):this.waitTime(0)}},ma);var ka=Phaser.Utils.Objects.GetValue,ba=function(t,e){this.clickTarget=void 0,this.cameraTarget=void 0,this.managersScene=t,this.gameObjectManagers={};var i=ka(e,"layers",!1);!1!==i&&(this.gameObjectManagers.layer=new po(t,i));var n=ka(e,"sounds");return !1!==n&&(this.soundManager=new ra(t,n)),this.timeline=new pa(this),this.waitEventManager=new ya(this,e),this},xa=function(t){for(var e in this.timeline.timeScale=t,this.gameObjectManagers)this.gameObjectManagers[e].setTimeScale(t);return this},Ca=function(){return this.timeline.timeScale},wa=function(t){for(var e in this.waitEventManager.destroy(),this.waitEventManager=void 0,this.gameObjectManagers)this.gameObjectManagers[e].destroy(t),delete this.gameObjectManagers[e];this.soundManager&&(this.soundManager.destroy(),this.soundManager=void 0),this.timeline&&(this.timeline.destroy(),this.timeline=void 0),this.clickTarget=void 0,this.cameraTarget=void 0,this.managersScene=void 0;},Sa={addGameObjectManager:function(t,e){void 0===t&&(t={}),void 0===e&&(e=uo),t.createGameObjectScope||(t.createGameObjectScope=this);var i=new e(this.managersScene,t);return this.gameObjectManagers[t.name]=i,this},getGameObjectManager:function(t,e){if(t)return i=this.gameObjectManagers[t];for(var t in this.gameObjectManagers){var i;if((i=this.gameObjectManagers[t]).has(e))return i}},getGameObjectManagerNames:function(){var t=[];for(var e in this.gameObjectManagers)t.push(e);return t},getGameObjectManagerName:function(t){for(var e in this.gameObjectManagers)if(this.gameObjectManagers[e].has(t))return e},hasGameObjectMananger:function(t){return t in this.gameObjectManagers}},Pa={createGameObject:function(t,e){for(var i,n=arguments.length,s=new Array(n>2?n-2:0),r=2;r<n;r++)s[r-2]=arguments[r];return (i=this.getGameObjectManager(t,e)).add.apply(i,[e].concat(s)),this},destroyGameObject:function(t,e){var i=this.getGameObjectManager(t,e);return void 0===e?i.removeAll():i.remove(e),this},hasGameObject:function(t,e){return !!this.getGameObjectManager(t,e)},callGameObjectMethod:function(t,e,i){for(var n,s=arguments.length,r=new Array(s>3?s-3:0),o=3;o<s;o++)r[o-3]=arguments[o];return (n=this.getGameObjectManager(t,e)).call.apply(n,[e,i].concat(r)),this},setGameObjectProperty:function(t,e,i,n){return this.getGameObjectManager(t,e).setProperty(e,i,n),this},easeGameObjectProperty:function(t,e,i,n,s,r,o,a){return this.getGameObjectManager(t,e).easeProperty(e,i,n,s,r,o,a),this},getGameObjectTweenTask:function(t,e,i){return this.getGameObjectManager(t,e).getTweenTask(e,i)},getGameObject:function(t,e,i){var n=this.getGameObjectManager(t,e);if("string"==typeof e)return n.getGO(e);var s=e;for(e in void 0===s&&(s=n.bobs),void 0===i&&(i={}),s)i[e]=n.getGO(e);return i},addGameObject:function(t,e,i){var n=this.getGameObjectManager(t,e);if("string"==typeof e)n.addGO(e,i);else {var s=e;for(e in s)n.addGO(e,s[e]);}return this},drawGameObjectsBounds:function(t,e,i){t instanceof Phaser.GameObjects.Graphics&&(i=e,e=t,t=void 0),void 0===t&&(t=this.getGameObjectManagerNames()),Array.isArray(t)||(t=[t]);for(var n=0,s=t.length;n<s;n++)this.getGameObjectManager(t[n]).drawGameObjectsBounds(e,i);return this}},Ta=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,Oa=/^0x[0-9A-F]+$/i,Ma=function(t){if("string"!=typeof t)return t;if(""===t)t=null;else if(Ta.test(t))t=parseFloat(t);else if(Oa.test(t))t=parseInt(t,16);else switch(t){case"false":t=!1;break;case"true":t=!0;break;case"null":t=null;break;case"undefined":t=void 0;}return t},Ea=function(){function t(e){h(this,t),this.setEventEmitter(wt(e,"eventEmitter",void 0)),this.setValueConverter(wt(e,"valueConvert",!0)),this.setLoopEnable(wt(e,"loop",!1)),this.setMultipleLinesTagEnable(wt(e,"multipleLinesTag",!1));var i=wt(e,"delimiters","<>");this.setDelimiters(i[0],i[1]),this.setTranslateTagNameCallback(wt(e,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null;}return u(t,[{key:"shutdown",value:function(){this.destroyEventEmitter();}},{key:"destroy",value:function(){this.shutdown();}},{key:"setMultipleLinesTagEnable",value:function(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}},{key:"setDelimiters",value:function(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=un(this.delimiterLeft),e=un(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp("".concat(t,"(.+?)").concat(e),i),this}},{key:"setTranslateTagNameCallback",value:function(t){return this.translateTagNameCallback=t,this}},{key:"setValueConverter",value:function(t){return !0===t?t=Ma:t||(t=_a),this.valueConverter=t,this}},{key:"setLoopEnable",value:function(t){return void 0===t&&(t=!0),this.loopEnable=t,this}},{key:"setSource",value:function(t){return this.source=t,this}},{key:"resetIndex",value:function(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}},{key:"start",value:function(t){return this.setSource(t).restart(),this}},{key:"restart",value:function(){this.resetIndex().next();}},{key:"next",value:function(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex<e&&(this.onContent(t.substring(this.progressIndex,e)),this.isPaused)){this.progressIndex=e;break}return this.onComplete(),void(this.isRunning=!1)}var n=this.reSplit.lastIndex,s=n-i[0].length;if(this.progressIndex<s&&(this.onContent(t.substring(this.progressIndex,s)),this.isPaused)){this.progressIndex=s;break}if(this.onTag(i[1]),this.progressIndex=n,this.isPaused)break}return this.isRunning=!1,this}},{key:"skipEvent",value:function(){return this.skipEventFlag=!0,this}},{key:"pause",value:function(){return this.isPaused||this.onPause(),this}},{key:"pauseUntilEvent",value:function(t,e){return this.isPaused||(this.pause(),t.once(e,(function(){this.next();}),this)),this}},{key:"onContent",value:function(t){this.skipEventFlag=!1,this.emit("content",t),this.lastContent=t;}},{key:"onTag",value:function(t){}},{key:"onStart",value:function(){this.isRunning=!0,this.emit("start",this);}},{key:"onComplete",value:function(){this.isRunning=!1,this.justCompleted=!0,this.emit("complete",this),this.loopEnable&&this.resetIndex();}},{key:"onPause",value:function(){this.isPaused=!0,this.emit("pause",this);}},{key:"onResume",value:function(){this.isPaused=!1,this.emit("resume",this);}}]),t}(),_a=function(t){return t};Object.assign(Ea.prototype,vr);var Ra=function(e){function i(e){var n;h(this,i),void 0===e&&(e={}),e.hasOwnProperty("multipleLinesTag")||(e.multipleLinesTag=!1),(n=t(this,i,[e])).setTagExpression(wt(e,"regex.tag",void 0)),n.setValueExpression(wt(e,"regex.value",void 0));var s=wt(e,"delimiters","<>");return n.setDelimiters(s[0],s[1]),n}return d(i,e),u(i,[{key:"setTagExpression",value:function(t){return t||(t=La),this.tagExpression=t,this}},{key:"setValueExpression",value:function(t){return t||(t=La),this.valueExpression=t,this}},{key:"setDelimiters",value:function(t,e){m(f(i.prototype),"setDelimiters",this).call(this,t,e);var n="(".concat(this.tagExpression,")(=(").concat(this.valueExpression,"))?");if(this.reTag=RegExp(n,"i"),this.tagExpression!==La||this.valueExpression!==La){var s="".concat(this.tagExpression,"(=").concat(this.valueExpression,")?"),r="/".concat(this.tagExpression);t=un(this.delimiterLeft),e=un(this.delimiterRight);var o=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp("".concat(t,"((").concat(s,")|(").concat(r,"))").concat(e),o);}return this}},{key:"onTag",value:function(t){var e=t.match(this.reTag),i=e[1],n="/"===i.charAt(0);if(n&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,n)this.emit("-".concat(i)),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else {var s=function(t,e,i){if(null==t)return [];void 0===e&&(e=Ma),void 0===i&&(i=",");for(var n=t.split(i),s=0,r=n.length;s<r;s++)n[s]=e(n[s]);return n}(e[3],this.valueConverter);this.emit.apply(this,["+".concat(i)].concat(w(s))),this.skipEventFlag||this.emit.apply(this,["+",i].concat(w(s))),this.lastTagStart=i;}}}]),i}(Ea),La="[^=]+",Ba=function(t){this.typeWriter.setTypingSpeed(t);},Da=function(t,e){Bs.call(t,"speed",Ba,e,t);},Ia=function(t){if(!this.skipSoundEffect){var e=t[0],i=t[1];this.soundManager.playSoundEffect(e),i&&this.soundManager.fadeInSoundEffect(i);}},ja=function(t){if(!this.skipSoundEffect){var e=t[0],i=t[1];this.soundManager.playSoundEffect2(e),i&&this.soundManager.fadeInSoundEffect2(i);}},za=function(t){this.soundManager.fadeInSoundEffect(t);},Aa=function(t){this.soundManager.fadeInSoundEffect2(t);},Fa=function(t){var e;(e=this.soundManager).fadeOutSoundEffect.apply(e,w(t));},Wa=function(t){var e;(e=this.soundManager).fadeOutSoundEffect2.apply(e,w(t));},Va=function(t){this.soundManager.setSoundEffectVolume(t,!0);},Ya=function(t){this.soundManager.setSoundEffectVolume2(t,!0);},Ga=function(){this.soundManager.setSoundEffectMute(!0);},Xa=function(){this.soundManager.setSoundEffect2Mute(!0);},Ha=function(){this.soundManager.setSoundEffectMute(!1);},Ua=function(){this.soundManager.setSoundEffect2Mute(!1);},Na=function(t){var e=t[0],i=t[1];this.soundManager.playBackgroundMusic(e),i&&this.soundManager.fadeInBackgroundMusic(i);},Ka=function(){this.soundManager.stopBackgroundMusic();},Ja=function(t){var e=t[0],i=t[1];this.soundManager.playBackgroundMusic2(e),i&&this.soundManager.fadeInBackgroundMusic2(i);},qa=function(){this.soundManager.stopBackgroundMusic2();},Za=function(t){this.soundManager.fadeInBackgroundMusic(t);},$a=function(t){this.soundManager.fadeInBackgroundMusic2(t);},Qa=function(t){var e;(e=this.soundManager).fadeOutBackgroundMusic.apply(e,w(t));},th=function(t){var e;(e=this.soundManager).fadeOutBackgroundMusic2.apply(e,w(t));},eh=function(t){var e;(e=this.soundManager).crossFadeBackgroundMusic.apply(e,w(t));},ih=function(t){var e;(e=this.soundManager).crossFadeBackgroundMusic2.apply(e,w(t));},nh=function(){this.soundManager.pauseBackgroundMusic();},sh=function(){this.soundManager.resumeBackgroundMusic();},rh=function(){this.soundManager.pauseBackgroundMusic2();},oh=function(){this.soundManager.resumeBackgroundMusic2();},ah=function(t){this.soundManager.setBackgroundMusicVolume(t);},hh=function(t){this.soundManager.setBackgroundMusicVolume2(t);},lh=function(){this.soundManager.setBackgroundMusicMute(!0);},uh=function(){this.soundManager.setBackgroundMusic2Mute(!0);},ch=function(){this.soundManager.setBackgroundMusicMute(!1);},dh=function(){this.soundManager.setBackgroundMusic2Mute(!1);},fh=function(t){var e;(e=this.cameraTarget).fadeIn.apply(e,w(t));},ph=function(t){var e;(e=this.cameraTarget).fadeOut.apply(e,w(t));},vh=function(t){var e;(e=this.cameraTarget).shake.apply(e,w(t));},gh=function(t){var e;(e=this.cameraTarget).flash.apply(e,w(t));},yh=function(t){this.cameraTarget.setZoom(t);},mh=function(t){var e;(e=this.cameraTarget).zoomTo.apply(e,w(t));},kh=Phaser.Math.DegToRad,bh=function(t){this.cameraTarget.setRotation(t);},xh=function(t){var e=t[0],i=t[1],n=t[2];this.cameraTarget.rotateTo(e,!1,i,n);},Ch=function(t){var e;(e=this.cameraTarget).setScroll.apply(e,w(t));},wh=function(t){var e=t[0],i=t[1],n=t[2],s=t[3],r=this.cameraTarget,o=r.scrollX,a=r.scrollY;r.setScroll(e,i),e+=r.centerX,i+=r.centerY,r.setScroll(o,a),r.pan(e,i,n,s);},Sh=function(t){this.typeWriter.wait(t);},Ph=function(t,e){Bs.call(t,"wait",Sh,e,t);},Th=function(t,e){var i="tag.".concat(e);null==t?this.emit(i):this.emit.apply(this,[i].concat(w(t)));},Oh=function(t,e,i){Bs.call(t,e,Th,i,t);},Mh=[function(t,e,i){var n,s="color";e.on("start",(function(){n=t.textStyle.color;})).on("+".concat(s),(function(i){t.textStyle.setColor(i),e.skipEvent();})).on("-".concat(s),(function(){t.textStyle.setColor(n),e.skipEvent();})).on("complete",(function(){t.textStyle.setColor(n);}));},function(t,e,i){var n,s="stroke";e.on("start",(function(){n=t.textStyle.stroke,t.textStyle.setStrokeStyle(null);})).on("+".concat(s),(function(i){void 0===i&&(i=n),t.textStyle.setStrokeStyle(i),e.skipEvent();})).on("-".concat(s),(function(){t.textStyle.setStrokeStyle(null),e.skipEvent();})).on("complete",(function(){t.textStyle.setStrokeStyle(n);}));},function(t,e,i){e.on("start",(function(){t.textStyle.setBold(!1);})).on("+".concat("b"),(function(){t.textStyle.setBold(!0),e.skipEvent();})).on("-".concat("b"),(function(){t.textStyle.setBold(!1),e.skipEvent();}));},function(t,e,i){e.on("start",(function(){t.textStyle.setItalic(!1);})).on("+".concat("i"),(function(){t.textStyle.setItalic(!0),e.skipEvent();})).on("-".concat("i"),(function(){t.textStyle.setItalic(!1),e.skipEvent();}));},function(t,e,i){var n,s="size";e.on("start",(function(){n=t.textStyle.fontSize;})).on("+".concat(s),(function(i){t.textStyle.setFontSize(i),e.skipEvent();})).on("-".concat(s),(function(){t.textStyle.setFontSize(n),e.skipEvent();})).on("complete",(function(){t.textStyle.setFontSize(n);}));},function(t,e,i){var n,s="shadow";e.on("start",(function(){n=t.textStyle.shadowColor,t.textStyle.setShadowColor(null);})).on("+".concat(s),(function(i){void 0===i&&(i=n),t.textStyle.setShadowColor(i),e.skipEvent();})).on("-".concat(s),(function(){t.textStyle.setShadowColor(null),e.skipEvent();})).on("complete",(function(){t.textStyle.setShadowColor(n);}));},function(t,e,i){var n="align";e.on("+".concat(n),(function(i){t.textStyle.setAlign(i),e.skipEvent();})).on("-".concat(n),(function(){t.textStyle.setAlign(),e.skipEvent();})).on("complete",(function(){t.textStyle.setAlign();}));},function(t,e,i){var n;e.on("start",(function(){n=t.textStyle.offsetY,t.textStyle.setOffsetY(0);})).on("+".concat("y"),(function(i){void 0===i&&(i=n),t.textStyle.setOffsetY(i),e.skipEvent();})).on("-".concat("y"),(function(){t.textStyle.setOffsetY(0),e.skipEvent();})).on("complete",(function(){t.textStyle.setOffsetY(0);}));},function(t,e,i){var n;e.on("start",(function(){n=t.textStyle.offsetY,t.textStyle.setOffsetX(0);})).on("+".concat("x"),(function(i){void 0===i&&(i=n),t.textStyle.setOffsetX(i),e.skipEvent();})).on("-".concat("x"),(function(){t.textStyle.setOffsetX(0),e.skipEvent();})).on("complete",(function(){t.textStyle.setOffsetX(0);}));},function(t,e,i){var n,s="left";e.on("start",(function(){n=t.textStyle.leftSpace,t.textStyle.setLeftSpace(0);})).on("+".concat(s),(function(i){void 0===i&&(i=n),t.textStyle.setLeftSpace(i),e.skipEvent();})).on("-".concat(s),(function(){t.textStyle.setLeftSpace(0),e.skipEvent();})).on("complete",(function(){t.textStyle.setLeftSpace(0);}));},function(t,e,i){var n,s="right";e.on("start",(function(){n=t.textStyle.rightSpace,t.textStyle.setRightSpace(0);})).on("+".concat(s),(function(i){void 0===i&&(i=n),t.textStyle.setRightSpace(i),e.skipEvent();})).on("-".concat(s),(function(){t.textStyle.setRightSpace(0),e.skipEvent();})).on("complete",(function(){t.textStyle.setRightSpace(0);}));},function(t,e,i){e.on("+".concat("img"),(function(i){var n=t.imageManager.get(i);Ms.call(t,n.key,n.frame,{width:n.width,hieght:n.height,leftSpace:n.left,rightSpace:n.right,color:n.tintFill?t.textStyle.color:void 0}),e.skipEvent();})).on("-".concat("img"),(function(){e.skipEvent();}));},function(t,e,i){var n="space";e.on("+".concat(n),(function(i){Rs.call(t,i),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));},function(t,e,i){var n="speed";e.on("+".concat(n),(function(i){Da(t,i),e.skipEvent();})).on("-".concat(n),(function(){Da(t,void 0),e.skipEvent();}));},function(t,e,i){var n="se";e.on("+".concat(n),(function(i,s){Bs.call(t,n,Ia,[i,s],t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="se2";e.on("+".concat(n),(function(i,s){Bs.call(t,n,ja,[i,s],t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));},function(t,e,i){var n="se.fadein";e.on("+".concat(n),(function(i){Bs.call(t,n,za,i,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="se2.fadein";e.on("+".concat(n),(function(i){Bs.call(t,n,Aa,i,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));},function(t,e,i){var n="se.fadeout";e.on("+".concat(n),(function(i,s){Bs.call(t,n,Fa,[i,s="stop"===s],t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="se2.fadeout";e.on("+".concat(n),(function(i,s){Bs.call(t,n,Wa,[i,s="stop"===s],t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));},function(t,e,i){var n="se.volume";e.on("+".concat(n),(function(i){Bs.call(t,n,Va,i,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="se2.volume";e.on("+".concat(n),(function(i){Bs.call(t,n,Ya,i,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));},function(t,e,i){var n="se.mute";e.on("+".concat(n),(function(){Bs.call(t,n,Ga,void 0,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="se2.mute";e.on("+".concat(n),(function(){Bs.call(t,n,Xa,void 0,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="se.unmute";e.on("+".concat(n),(function(){Bs.call(t,n,Ha,void 0,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="se2.unmute";e.on("+".concat(n),(function(){Bs.call(t,n,Ua,void 0,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));},function(t,e,i){var n="bgm";e.on("+".concat(n),(function(i,s){Bs.call(t,n,Na,[i,s],t),e.skipEvent();})).on("-".concat(n),(function(){Bs.call(t,"bgm.stop",Ka,void 0,t),e.skipEvent();}));n="bgm2";e.on("+".concat(n),(function(i,s){Bs.call(t,n,Ja,[i,s],t),e.skipEvent();})).on("-".concat(n),(function(){Bs.call(t,"bgm2.stop",qa,void 0,t),e.skipEvent();}));},function(t,e,i){var n="bgm.fadein";e.on("+".concat(n),(function(i){Bs.call(t,n,Za,i,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="bgm2.fadein";e.on("+".concat(n),(function(i){Bs.call(t,n,$a,i,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));},function(t,e,i){var n="bgm.fadeout";e.on("+".concat(n),(function(i,s){Bs.call(t,n,Qa,[i,s="stop"===s],t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="bgm2.fadeout";e.on("+".concat(n),(function(i,s){Bs.call(t,n,th,[i,s="stop"===s],t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));},function(t,e,i){var n="bgm.cross";e.on("+".concat(n),(function(i,s){Bs.call(t,n,eh,[i,s],t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="bgm2.cross";e.on("+".concat(n),(function(i,s){Bs.call(t,n,ih,[i,s],t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));},function(t,e,i){var n="bgm.pause";e.on("+".concat(n),(function(){Bs.call(t,n,nh,void 0,t),e.skipEvent();})).on("-".concat(n),(function(){Bs.call(t,"bgm.resume",sh,void 0,t),e.skipEvent();}));n="bgm2.pause";e.on("+".concat(n),(function(){Bs.call(t,n,rh,void 0,t),e.skipEvent();})).on("-".concat(n),(function(){Bs.call(t,"bgm2.resume",oh,void 0,t),e.skipEvent();}));},function(t,e,i){var n="bgm.volume";e.on("+".concat(n),(function(i){Bs.call(t,n,ah,i,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="bgm2.volume";e.on("+".concat(n),(function(i){Bs.call(t,n,hh,i,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));},function(t,e,i){var n="bgm.mute";e.on("+".concat(n),(function(){Bs.call(t,n,lh,void 0,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="bgm2.mute";e.on("+".concat(n),(function(){Bs.call(t,n,uh,void 0,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="bgm.unmute";e.on("+".concat(n),(function(){Bs.call(t,n,ch,void 0,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));n="bgm2.unmute";e.on("+".concat(n),(function(){Bs.call(t,n,dh,void 0,t),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();}));},function(t,e,i){var n="camera.fadein";e.on("+".concat(n),(function(i,s,r,o){Bs.call(t,n,fh,[i,s,r,o],t),e.skipEvent();}));},function(t,e,i){var n="camera.fadeout";e.on("+".concat(n),(function(i,s,r,o){Bs.call(t,n,ph,[i,s,r,o],t),e.skipEvent();}));},function(t,e,i){var n="camera.shake";e.on("+".concat(n),(function(i,s){Bs.call(t,n,vh,[i,s],t),e.skipEvent();}));},function(t,e,i){var n="camera.flash";e.on("+".concat(n),(function(i,s,r,o){Bs.call(t,n,gh,[i,s,r,o],t),e.skipEvent();}));},function(t,e,i){var n="camera.zoom";e.on("+".concat(n),(function(i){Bs.call(t,n,yh,i,t),e.skipEvent();})).on("+".concat(n,".to"),(function(i,n,s){Bs.call(t,"camera.zoom.to",mh,[i,n,s],t),e.skipEvent();}));},function(t,e,i){var n="camera.rotate";e.on("+".concat(n),(function(i){i=kh(i),Bs.call(t,n,bh,i,t),e.skipEvent();})).on("+".concat(n,".to"),(function(i,n,s){i=kh(i),Bs.call(t,"camera.rotate.to",xh,[i,n,s],t),e.skipEvent();}));},function(t,e,i){var n="camera.scroll";e.on("+".concat(n),(function(i,s){Bs.call(t,n,Ch,[i,s],t),e.skipEvent();})).on("+".concat(n,".to"),(function(i,n,s,r){Bs.call(t,"camera.scroll.to",wh,[i,n,s,r],t),e.skipEvent();}));},function(t,e,i){var n="wait",s="click";e.on("+".concat(n),(function(i){Ph(t,i),e.skipEvent();})).on("-".concat(n),(function(){e.skipEvent();})).on("+".concat(s),(function(){Ph(t,"click"),e.skipEvent();})).on("-".concat(s),(function(){e.skipEvent();}));},function(t,e,i){e.on("+".concat("r"),(function(){Ts.call(t,"\n"),e.skipEvent();})).on("-".concat("r"),(function(){e.skipEvent();}));},function(t,e,i){for(var n=["pagebreak","pb"],s=0,r=n.length;s<r;s++){var o=n[s];e.on("+".concat(o),(function(){Ts.call(t,"\f"),e.skipEvent();})).on("-".concat(o),(function(){e.skipEvent();}));}},function(t,e,i){e.on("+".concat("content.off"),(function(){e.setContentOutputEnable(!1),e.skipEvent();}));},function(t,e,i){e.on("+".concat("content.on"),(function(){e.setContentOutputEnable(),e.skipEvent();}));},function(t,e,i){e.on("content",(function(i){if(e.contentOutputEnable)Ts.call(t,i);else {var n="+".concat(e.lastTagStart);t.emit("parser.".concat(n,"#content"),e,i);}}));},function(t,e,i){e.on("start",(function(){t.emit("parser.start",e);})).on("+",(function(i){if(!e.skipEventFlag){for(var n="+".concat(i),s=arguments.length,r=new Array(s>1?s-1:0),o=1;o<s;o++)r[o-1]=arguments[o];var a=r;t.emit.apply(t,["parser.".concat(n),e].concat(r,[a])),Oh(t,n,a);}})).on("-",(function(i){if(!e.skipEventFlag){var n="-".concat(i),s=[];t.emit("parser.".concat(n),e,s),Oh(t,n,s);}})).on("complete",(function(){t.emit("parser.complete",e);}));}],Eh=Phaser.Utils.Objects.GetValue,_h=function(e){function i(e,n){var s;return h(this,i),void 0===n&&(n={}),n.hasOwnProperty("delimiters")||(n.delimiters="[]"),function(t,e,i){for(var n=0,s=Mh.length;n<s;n++)Mh[n](t,e,i);}(e,v(s=t(this,i,[n])),n),s.setCommentLineStartSymbol(Eh(n,"comment","//")),s.setContentOutputEnable(),s}return d(i,e),u(i,[{key:"setCommentLineStartSymbol",value:function(t){return this.commentLineStart=t,this}},{key:"setContentOutputEnable",value:function(t){return void 0===t&&(t=!0),this.contentOutputEnable=t,this}},{key:"start",value:function(t){return m(f(i.prototype),"start",this).call(this,function(t,e){for(var i=t.commentLineStart,n=e.split("\n"),s=0,r=n.length;s<r;s++){var o=n[s];""===o||(0===o.trim().length||i&&o.startsWith(i))&&(n[s]="");}return n.join("")}(this,t)),this}}]),i}(Ra),Rh={setDefaultTypingSpeed:function(t){return this.defaultSpeed=t,this},setTypingSpeed:function(t){return void 0===t&&(t=this.defaultSpeed),this.speed=t,this}},Lh="page.fadeout",Bh="_remove.play",Dh=[Lh,Bh],Ih=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},jh=function(t){return Ih(t,"complete")},zh="anim",Ah=function(t){switch(t){case"camera.fadein":case"camera.fadeout":case"camera.flash":case"camera.shake":case"camera.zoom":case"camera.rotate":case"camera.scroll":return !0;default:return !1}},Fh=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},Wh=function(t,e,i,n){var s=t.waitEventManager,r=e.split("."),o=r[0],a=t.getGameObjectManager(o),h="wait.".concat(o);switch(r.length){case 1:return s.waitGameObjectManagerEmpty(o),void t.emit(h);case 2:var l=r[1];return s.waitGameObjectDestroy(o,l),void t.emit(h,l);case 3:l=r[1];var u=r[2];if("number"==typeof a.getProperty(l,u))return s.waitGameObjectTweenComplete(o,l,u),void t.emit(h,l,u);var c=u,d=c.startsWith("!");return d&&(c=c.substring(1)),a.hasData(l,c)?(s.waitGameObjectDataFlag(o,l,c,!d),void t.emit(h,l,c)):void s.waitTime(0)}},Vh=Phaser.Input.Keyboard.KeyCodes,Yh=function(t,e,i,n){var s=t.waitEventManager;s.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,n);for(var r=0,o=(e="string"==typeof e&&e.length>1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;r<o;r++){var a=e[r];if(null==a||"wait"===a){var h=t.waitEventManager.getWaitCompleteTriggerCallback();t.emit("wait",h);}else if("number"!=typeof a&&isNaN(a))if("click"===a)s.waitClick(),t.emit("wait.click");else if("se"===a){s.waitSoundEffectComplete();var l=t.soundManager.getLastSoundEffect();t.emit("wait.music",l);}else if("se2"===a){s.waitSoundEffect2Complete();l=t.soundManager.getLastSoundEffect2();t.emit("wait.music",l);}else if("bgm"===a){s.waitBackgroundMusicComplete();l=t.soundManager.getBackgroundMusic();t.emit("wait.music",l);}else if("bgm2"===a){s.waitBackgroundMusic2Complete();l=t.soundManager.getBackgroundMusic2();t.emit("wait.music",l);}else if(Vh.hasOwnProperty(a.toUpperCase()))s.waitKeyDown(a),t.emit("wait.keydown",a);else if(Ah(a))s.waitCameraEffectComplete(a),t.emit("wait.camera",a);else if(Fh(t,a))Wh(t,a);else {h=t.waitEventManager.getWaitCompleteTriggerCallback();t.emit("wait.".concat(a),h);}else {var u=parseFloat(a);s.waitTime(u),t.emit("wait.time",u);}}},Gh={fadeOutPage:function(){if(!this.fadeOutPageCallback||!this.children)return this.emit(Lh),this;var t=this.children.filter((function(t){return t.renderable})),e=this.fadeOutPageCallback(t,this.fadeOutPageDuration);if(e)if(e.once)e.once("complete",(function(){this.emit(Lh);}),this);else if(e.then){var i=this;e.then((function(){i.emit(Lh);}));}else this.emit(Lh);else this.emit(Lh);return this},start:function(t){return this.children=t,this.index=0,this.isPageTyping=!0,this.onTypeStart&&this.onTypeStart(t),this.typing(),jh(this)},typing:function t(e){void 0===e&&(e=0);var i,n=0;for(this.inTypingProcessLoop=!0;this.inTypingProcessLoop;){var s=this.getNextChild();if(!s){this.timeline.isRunning?this.timeline.once("complete",(function(){this.isPageTyping=!1,this.emit("complete");}),this):(this.isPageTyping=!1,this.emit("complete"));break}if(s.renderable){var r=this.animationConfig;if(r.duration>0){var o=this.timeline.addTimer({name:zh,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&o.seek(1);}else r.onStart&&r.onStart(s,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",s);var a=this.nextChild;if(a)if(this.skipSpaceEnable&&((i=a).type===gs&&" "===i.text));else if(n+=this.speed+e,e=0,n>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:n,onComplete:function(e,i,n){e.typingTimer=void 0,t.call(e,n.remainder);}});break}}else Ss(s)&&s.exec();}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1;},pause:function(){return this.timeline.pause(),this},resume:function(){return this.timeline.resume(),this},pauseTyping:function(){return this.isTypingPaused||(this.typingTimer?(this.typingTimer.pause(),this.isTypingPaused=!0):this.inTypingProcessLoop&&(this.inTypingProcessLoop=!1,this.isTypingPaused=!0)),this},resumeTyping:function(t){return this.isTypingPaused?(void 0===t&&(t=0),this.typingTimer?(this.isTypingPaused=!1,this.typingTimer.resume(),this.typingTimer.remainder+=t):this.isTypingPaused&&(this.isTypingPaused=!1,this.typing(t)),this):this},wait:function(t){return this.ignoreWait||(this.pauseTyping(),Yh(this.textPlayer,t,this.resumeTyping,this)),this},setIgnoreWait:function(t){return void 0===t&&(t=!0),this.ignoreWait=t,this},setSkipSpaceEnable:function(t){return void 0===t&&(t=!0),this.skipSpaceEnable=t,this},setSkipTypingAnimation:function(t){if(void 0===t&&(t=!0),this.skipTypingAnimation=t,t)for(var e=this.timeline.getTimers(zh),i=0,n=e.length;i<n;i++)e[i].seek(1);return this},setSkipSoundEffect:function(t){if(void 0===t&&(t=!0),this.skipSoundEffect=t,t){var e=this.textPlayer._soundManager;e&&e.fadeOutAllSoundEffects(100,!0);}return this},skipCurrentTypingDelay:function(){return this.typingTimer&&this.typingTimer.seek(1),this}};Object.assign(Gh,Rh);var Xh=Phaser.Utils.Objects.GetValue,Hh=function(){function t(e,i){h(this,t),this.setEventEmitter(),this.textPlayer=e,this.isPageTyping=!1,this.typingTimer=void 0,this.pauseTypingTimer=void 0,this.inTypingProcessLoop=!1,this.isTypingPaused=!1,this.setIgnoreWait(!1),this.setSkipTypingAnimation(!1),this.setTypingStartCallback(Xh(i,"onTypingStart",Nh)),this.setDefaultTypingSpeed(Xh(i,"speed",250)),this.setTypingSpeed(),this.setSkipSpaceEnable(Xh(i,"skipSpace",!1)),this.setAnimationConfig(Xh(i,"animation",void 0)),this.setMinSizeEnable(Xh(i,"minSizeEnable",!1)),this.setFadeOutPageCallback(Xh(i,"fadeOutPage"));}return u(t,[{key:"destroy",value:function(){this.destroyEventEmitter(),this.textPlayer=void 0,this.typingTimer=void 0,this.pauseTypingTimer=void 0,this.onTypeStart=void 0,this.animationConfig=void 0;}},{key:"timeline",get:function(){return this.textPlayer.timeline}},{key:"setTypingStartCallback",value:function(t){return this.onTypeStart=t,this}},{key:"setAnimationConfig",value:function(t){return t||(t={}),t.hasOwnProperty("duration")||(t.duration=0),t.hasOwnProperty("onStart")||(t.onStart=Uh),this.animationConfig=t,this}},{key:"setFadeOutPageCallback",value:function(t){return this.fadeOutPageCallback=t,this}},{key:"setMinSizeEnable",value:function(t){return void 0===t&&(t=!0),this.minSizeEnable=t,this}},{key:"getNextChild",value:function(){var t=this.nextChild;return this.index=Math.min(this.index+1,this.children.length),this._nextChild=void 0,t}},{key:"nextChild",get:function(){return this._nextChild||(this._nextChild=this.children[this.index]),this._nextChild}}]),t}(),Uh=function(t){t.setVisible&&t.setVisible();},Nh=function(t){for(var e=0,i=t.length;e<i;e++){var n=t[e];n.setVisible&&n.setVisible(!1);}};Object.assign(Hh.prototype,vr,Gh);var Kh=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"playAnimation",value:function(t){return this.gameObject.anims.timeScale=this.timeScale,this.gameObject.play(t),this}},{key:"stopAnimation",value:function(){return this.gameObject.stop(),this}},{key:"chainAnimation",value:function(t){return this.gameObject.chain(t),this}},{key:"pauseAnimation",value:function(){return this.gameObject.anims.pause(),this}},{key:"setTimeScale",value:function(t){return m(f(i.prototype),"setTimeScale",this).call(this,t),this.gameObject.anims&&(this.gameObject.anims.timeScale=t),this}}]),i}(mr),Jh={};Object.assign(Jh,{playAnimation:function(t,e){return this.has(t)||this.add(t),this.get(t).playAnimation(e),this},stopAnimation:function(t){return this.has(t)?(this.get(t).stopAnimation(),this):this},chainAnimation:function(t,e){return this.has(t)?(this.get(t).chainAnimation(e),this):this},pauseAnimation:function(t){return this.has(t)?(this.get(t).pauseAnimation(),this):this}});var qh=function(e){function i(e,n){return h(this,i),void 0===n&&(n={}),n.BobClass=Kh,t(this,i,[e,n])}return d(i,e),u(i,[{key:"setCreateGameObjectCallback",value:function(t,e){return t&&"sprite"!==t?"image"===t&&(t=$h):t=Zh,m(f(i.prototype),"setCreateGameObjectCallback",this).call(this,t,e),this}}]),i}(uo),Zh=function(t,e,i){return "string"!=typeof i&&"number"!=typeof i&&(i=void 0),t.add.sprite(0,0,e,i)},$h=function(t,e,i){return "string"!=typeof i&&"number"!=typeof i&&(i=void 0),t.add.image(0,0,e,i)};Object.assign(qh.prototype,Jh);var Qh=function(t,e){return 3===t.length&&t[0]===e&&"play"===t[2]},tl=function(t){var e,i,n,s=x(t,3);e=s[0],i=s[1];var r=(n=s[2]).shift(),o=this.getGameObjectManager(e);o.playAnimation(i,r),n.length>0&&o.chainAnimation(i,n);},el=function(t){var e,i,n=C(t);e=n[0],i=n.slice(1);var s=this.getGameObjectManager(e);s.stopAnimation.apply(s,w(i));},il=function(t){var e,i,n=C(t);e=n[0],i=n.slice(1);var s=this.getGameObjectManager(e);s.pauseAnimation.apply(s,w(i));},nl=function(t){var e,i,n=C(t);e=n[0],i=n.slice(1);var s=this.getGameObjectManager(e);s.chainAnimation.apply(s,w(i));},sl=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var s,r=i.split(".");if(Qh(r,n)){s=r[1];for(var o=arguments.length,a=new Array(o>1?o-1:0),h=1;h<o;h++)a[h-1]=arguments[h];Bs.call(t,"".concat(n,".play"),tl,[n,s,a],t),e.skipEvent();}}})).on("+",(function(i){if(!e.skipEventFlag){var s,r=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"stop"===t[2]})(r,n)&&(s=r[1],Bs.call(t,"".concat(n,".stop"),el,[n,s],t),e.skipEvent());}})).on("-",(function(i){if(!e.skipEventFlag){var s,r=i.split(".");Qh(r,n)&&(s=r[1],Bs.call(t,"".concat(n,".stop"),el,[n,s],t),e.skipEvent());}}));},function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var s,r=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(r,n)&&(s=r[1],Bs.call(t,"".concat(n,".pause"),il,[n,s],t),e.skipEvent());}}));},function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var s,r=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e&&"chain"===t[2]}(r,n)){s=r[1];var o=Array.prototype.slice.call(arguments,1);Bs.call(t,"".concat(n,".chain"),nl,[n,s,o],t),e.skipEvent();}}}));}],rl=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=sl,this.addGameObjectManager(t,qh);},ol=function(t,e){return 2===t.length&&t[0]===e},al=function(t){var e,i,n=C(t);e=n[0],i=n.slice(1);var s=this.getGameObjectManager(e);s.add.apply(s,w(i));},hl=function(t){var e,i,n=C(t);e=n[0],i=n.slice(1);var s=this.getGameObjectManager(e);s.remove.apply(s,w(i));},ll=function(t){this.getGameObjectManager(t).removeAll();},ul=function(t){var e,i,n,s,r=C(t);e=r[0],i=r[1],n=r[2],s=r.slice(3);var o="".concat(e,".").concat(n);if(this.emit.apply(this,[o,i].concat(w(s))),!(this.listenerCount(o)>0)){var a=this.getGameObjectManager(e);a.hasMethod(i,n)?a.call.apply(a,[i,n].concat(w(s))):a.setProperty(i,n,s[0]);}},cl={to:!0,yoyo:!0,from:!0,toLeft:!0,toRight:!0,toUp:!0,toDown:!0,yoyoLeft:!0,yoyoRight:!0,yoyoUp:!0,yoyoDown:!0,fromLeft:!0,fromRight:!0,fromUp:!0,fromDown:!0},dl=function(t){var e,i,n,s,r,o,a,h,l=x(t,8);e=l[0],i=l[1],n=l[2],s=l[3],r=l[4],o=l[5],a=l[6],h=l[7];var u=this.getGameObjectManager(e),c=u.getProperty(i,n);if("number"==typeof c){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?s=c-s:h.startsWith("from")&&(u.setProperty(i,n,c-s),s=c):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?s=c+s:h.startsWith("from")&&(u.setProperty(i,n,c+s),s=c):"from"===h&&(u.setProperty(i,n,s),s=c);var d=h.startsWith("yoyo");u.easeProperty(i,n,s,r,o,a,d);}},fl=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var s,r=i.split(".");if(ol(r,n)){s=r[1];for(var o=arguments.length,a=new Array(o>1?o-1:0),h=1;h<o;h++)a[h-1]=arguments[h];Bs.call(t,"".concat(n,".add"),al,[n,s].concat(a),t),e.skipEvent();}}})).on("-",(function(i){if(!e.skipEventFlag){var s,r=i.split(".");ol(r,n)&&(s=r[1],Bs.call(t,"".concat(n,".remove"),hl,[n,s],t),e.skipEvent());}}));},function(t,e,i){var n=i.name;e.on("-",(function(i){e.skipEventFlag||i===n&&(Bs.call(t,"".concat(n,".removeall"),ll,n,t),e.skipEvent());}));},function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var s,r,o=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e}(o,n)){s=o[1],r=o[2];for(var a=arguments.length,h=new Array(a>1?a-1:0),l=1;l<a;l++)h[l-1]=arguments[l];Bs.call(t,"".concat(n,".call"),ul,[n,s,r].concat(h),t),e.skipEvent();}}}));},function(t,e,i){var n=i.name;t.getGameObjectManager(n),e.on("+",(function(i,s,r,o,a){if(!e.skipEventFlag){var h,l,u,c=i.split(".");(function(t,e){return 4===t.length&&t[0]===e&&cl[t[3]]})(c,n)&&(h=c[1],l=c[2],u=c[3],"number"==typeof o&&(a=o,o=void 0),Bs.call(t,"".concat(n,".ease"),dl,[n,h,l,s,r,o,a,u],t),e.skipEvent());}}));}],pl=Sa.addGameObjectManager,vl={addGameObjectManager:function(t,e){void 0===t&&(t={}),t.name||console.warn("Parameter 'name' is required in TextPlayer.addGameObjectManager(config) method"),pl.call(this,t,e);for(var i=t.parseCallbacks,n=0,s=(i=i?[].concat(w(i),fl):fl).length;n<s;n++)i[n](this,this.parser,t);return this}},gl={play:function(t){return this.isPlaying||(this.removeChildren(),this.parser.start(t),this.isPlaying=!0,this.once("complete",(function(){this.isPlaying=!1;}),this),this.lastWrapResult=void 0,this.typingNextPage()),this},playPromise:function(t){var e=jh(this);return this.play(t),e}},yl=function(){return !this.isPlaying||this.isPageTyping||this.typeWriter.once(Lh,ml,this).fadeOutPage(),this},ml=function(){var t=this.runWrap(this.lastWrapResult);this.lastWrapResult=t,this.emit("page.start");var e=function(){this.emit(Bh),t.isLastPage?this.emit("complete"):(this.emit("page.complete"),this.ignoreNextPageInput?yl.call(this):this.nextPageInput&&this.nextPageInput(yl,this));};this.once(Bh,(function(){this.typeWriter.off("complete",e,this);}),this),this.typeWriter.once("complete",e,this).start(t.children);},kl={setClickTarget:function(t){return this.waitEventManager.setClickTarget(t),this},setCameraTarget:function(t){return this.waitEventManager.setCameraTarget(t),this},setNextPageInput:function(t){var e=this;this.nextPageInput=t?"function"==typeof t?function(i,n){var s=e.waitEventManager;s.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,n);var r=s.getWaitCompleteTriggerCallback();t.call(e,r);}:function(i,n){Yh(e,t,i,n);}:null;},addImage:function(t,e){return this.imageManager.add(t,e),this},typingNextPage:yl,wait:function(t){return this.typeWriter.wait(t),this},setIgnoreWait:function(t){return this.typeWriter.setIgnoreWait(t),this},setIgnoreNextPageInput:function(t){return void 0===t&&(t=!0),this.ignoreNextPageInput=t,this},showPage:function(){if(!this.isPlaying||!this.isPageTyping)return this;var t=this.typeWriter.speed,e=this.typeWriter.ignoreWait,i=this.typeWriter.skipTypingAnimation,n=this.typeWriter.skipSoundEffect;return this.typeWriter.once("complete",(function(){this.typeWriter.setTypingSpeed(t).setIgnoreWait(e).setSkipTypingAnimation(i).setSkipSoundEffect(n);}),this).setTypingSpeed(0).skipCurrentTypingDelay().setIgnoreWait(!0).setSkipTypingAnimation(!0).setSkipSoundEffect(!0),this}};Object.assign(kl,vl,gl,{pause:function(){return this.timeline.pause(),this},pauseTyping:function(){return this.typeWriter.pauseTyping(),this}},{resume:function(){return this.timeline.resume(),this},resumeTyping:function(t){return this.typeWriter.resumeTyping(t),this}},{setDefaultTypingSpeed:function(t){return this.defaultTypingSpeed=t,this},setTypingSpeed:function(t){return this.typingSpeed=t,this}},{getSprite:function(t){return this.getGameObject("sprite",t)},addSprite:function(t,e){return this.addGameObject("sprite",t,e),this}},{setContentOutputEnable:function(t){return this.parser.setContentOutputEnable(t),this},setContentCallback:function(t,e){return this.contentCallback=t,this.contentCallbackScope=e,this}});var bl=Phaser.Utils.Objects.IsPlainObject,xl=Phaser.Utils.Objects.GetValue,Cl=function(e){function i(e,n,s,r,o,a){var l;h(this,i),bl(n)?a=n:bl(r)&&(a=r),void 0===a&&(a={});var u=a.text;delete a.text,(l=t(this,i,[e,n,s,r,o,a])).type="rexTextPlayer",l.initManagers(e,a),l.parser=new _h(v(l),xl(a,"parser",void 0)),l.typeWriter=new Hh(v(l),xl(a,"typing",void 0)),l._imageManager=void 0;var c=xl(a,"images",void 0);c&&l.addImage(c);var d=xl(a,"sprites");return !1!==d&&null!==d&&rl.call(v(l),d),l.setIgnoreNextPageInput(xl(a,"ignoreNextPageInput",!1)),l.setNextPageInput(xl(a,"nextPageInput",null)),l.isPlaying=!1,u&&l.play(u),l}return d(i,e),u(i,[{key:"imageManager",get:function(){return void 0===this._imageManager&&(this._imageManager=new Ai(this.scene)),this._imageManager}},{key:"spriteManager",get:function(){return this.getGameObjectManager("sprite")}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(!function(t){for(var e=0,i=Dh.length;e<i;e++)t.emit(Dh[e]);}(this),this.parser.destroy(),this.parser=void 0,this.typeWriter.destroy(t),this.typeWriter=void 0,this._imageManager&&this._imageManager.destroy(t),this._imageManager=void 0,this.destroyManagers(t),m(f(i.prototype),"destroy",this).call(this,t));}},{key:"isPageTyping",get:function(){return this.typeWriter.isPageTyping}},{key:"defaultTypingSpeed",get:function(){return this.typeWriter.defaultTypingSpeed},set:function(t){this.typeWriter.setDefaultTypingSpeed(t);}},{key:"typingSpeed",get:function(){return this.typeWriter.speed},set:function(t){this.typeWriter.setTypingSpeed(t);}},{key:"timeScale",get:function(){return this.getTimeScale()},set:function(t){this.setTimeScale(t);}}]),i}(function(e){var i=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i)}(e),n={initManagers:ba,setTimeScale:xa,getTimeScale:Ca,destroyManagers:wa};return Object.assign(i.prototype,n,Sa,Pa),i}(pr));Object.assign(Cl.prototype,kl),E.register("textPlayer",(function(t,e,i,n,s){var r=new Cl(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.TextPlayer",Cl);var wl={maxLength:["maxLength",void 0],minLength:["minLength",void 0],readOnly:["readOnly",!1]},Sl={direction:["direction",void 0]},Pl=function t(e,i,n){if("string"==typeof n)e.hasOwnProperty(n)&&(i[n]=e[n]);else {var s=n;if(Array.isArray(s))for(var r=0,o=s.length;r<o;r++)t(e,i,s[r]);else for(var n in s)t(e,i,n);}},Tl=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!Ol(t,e)&&!(n&&!n(t,e)));for(var s=t.scene.input.manager,r=s.pointersTotal,o=s.pointers,a=0;a<r;a++)if(e=o[a],(!i||i(t,e))&&Ol(t,e)&&(!n||n(t,e)))return !0;return !1},Ol=function(t,e){for(var i=t.scene,n=i.input.cameras.getCamerasBelowPointer(e),s=i.input.manager,r=[t],o=0,a=n.length;o<a;o++)if(s.hitTest(e,r,n[o],Ml),Ml.length>0)return Ml.length=0,!0;return Ml.length=0,!1},Ml=[],El=void 0,_l=Phaser.Utils.Objects.GetValue,Rl=function(t,e,i){var n,s;for(var r in void 0===i&&(i={}),t)n=t[r],void 0!==(s=_l(e,r,n[1]))&&(i[n[0]]=s);return i},Ll=function(t){t.addEventListener("touchstart",Bl,!1),t.addEventListener("touchmove",Bl,!1),t.addEventListener("touchend",Bl,!1),t.addEventListener("mousedown",Bl,!1),t.addEventListener("mouseup",Bl,!1),t.addEventListener("mousemove",Bl,!1);},Bl=function(t){t.stopPropagation();},Dl=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this},Il=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",Dl,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this);},jl=function(){this.isOpened=!1,this.updateText(),this.scene.sys.events.off("postupdate",this.updateText,this),this.scene.input.off("pointerdown",this.onClickOutside,this),this.onCloseCallback&&this.onCloseCallback(this.parent,this),function(t){if(t){var e=t.parentElement;e&&e.removeChild(t);}}(this.node),this.node=void 0,this.emit("close",this);},zl=Phaser.Utils.Objects.GetValue,Al=function(t,e){var i,n=zl(e,"inputType",void 0);void 0===n&&(n=zl(e,"type","text")),"textarea"===n?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=n;var s=zl(e,"style",void 0),r=i.style;Rl(Sl,s,r),r.position="absolute",r.opacity=0,r.pointerEvents="none",r.zIndex=0,r.transform="scale(0)",Rl(wl,e,i),Ll(i);var o=t.scene.sys.scale;return (o.isFullscreen?o.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){Il.call(t);})),i.addEventListener("blur",(function(e){jl.call(t);})),i},Fl={open:function(){return this.isOpened||this.readOnly||((t=this)!==El&&(void 0!==El&&El.close(),El=t),this.node||(this.node=Al(this,this.nodeConfig)),this.setFocus()),this;var t;},close:function(){return this.isOpened?(this===El&&(El=void 0),this.setBlur(),this):this}},Wl=Phaser.Utils.Objects.GetValue,Vl=function(e){function i(e,n){var s;h(this,i),s=t(this,i,[e]);var r=Wl(n,"inputType",void 0);void 0===r&&(r=Wl(n,"type","text")),s.setEnterCloseEnable(Wl(n,"enterClose","textarea"!==r));var o=Wl(n,"onOpen",void 0);o||(o=Wl(n,"onFocus",void 0)),s.onOpenCallback=o;var a=Wl(n,"onClose",void 0);return a||(a=Wl(n,"onBlur",void 0)),s.onCloseCallback=a,s.onUpdateCallback=Wl(n,"onUpdate",void 0),s.isOpened=!1,e.on("pointerdown",(function(){this.open();}),v(s)).setInteractive(),s.nodeConfig=function(t){void 0===t&&(t={});var e={};return Pl(t,e,"inputType"),Pl(t,e,"type"),Pl(t,e,"style"),Pl(t,e,Sl),Pl(t,e,wl),e}(n),s.node=void 0,s}return d(i,e),u(i,[{key:"destroy",value:function(){this.close(),m(f(i.prototype),"destroy",this).call(this);}},{key:"onClickOutside",value:function(t){Tl(this.parent,t)||this.close();}},{key:"setEnterCloseEnable",value:function(t){return void 0===t&&(t=!0),this.enterCloseEnable=t,this}},{key:"initText",value:function(){}},{key:"updateText",value:function(){}},{key:"text",get:function(){return this.node?this.node.value:""},set:function(t){this.node&&(this.node.value=t);}},{key:"setText",value:function(t){return this.text=t,this}},{key:"maxLength",get:function(){return this.nodeConfig.maxLength},set:function(t){this.nodeConfig.maxLength=t,this.node&&(this.node.maxLength=t);}},{key:"setMaxLength",value:function(t){return this.maxLength=t,this}},{key:"minLength",get:function(){return this.nodeConfig.minLength},set:function(t){this.nodeConfig.minLength=t,this.node&&(this.node.minLength=t);}},{key:"setMinLength",value:function(t){return this.minLength=t,this}},{key:"placeholder",get:function(){return this.node.placeholder},set:function(t){this.node&&(this.node.placeholder=t);}},{key:"setPlaceholder",value:function(t){return this.placeholder=t,this}},{key:"selectText",value:function(t,e){return this.node?(void 0===t?this.node.select():this.node.setSelectionRange(t,e),this):this}},{key:"selectAll",value:function(){return this.selectText(),this}},{key:"selectionStart",get:function(){return this.node?this.node.selectionStart:0}},{key:"selectionEnd",get:function(){return this.node?this.node.selectionEnd:0}},{key:"selectedText",get:function(){if(!this.node)return "";var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}},{key:"cursorPosition",get:function(){return this.node?this.node.selectionStart:0},set:function(t){this.node&&this.node.setSelectionRange(t,t);}},{key:"setCursorPosition",value:function(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}},{key:"tooltip",get:function(){return this.node?this.node.title:""},set:function(t){if(!this.node)return this;this.node.title=t;}},{key:"setTooltip",value:function(t){return this.tooltip=t,this}},{key:"setTextChangedCallback",value:function(t){return this.onTextChanged=t,this}},{key:"readOnly",get:function(){return this.nodeConfig.readOnly},set:function(t){this.nodeConfig.readOnly=t,this.node&&(this.node.readOnly=t);}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}},{key:"spellCheck",get:function(){return this.node?this.node.spellcheck:""},set:function(t){this.node&&(this.node.spellcheck=t);}},{key:"setSpellCheck",value:function(t){return this.spellCheck=t,this}},{key:"fontColor",get:function(){if(this.node)return this.node.style.color},set:function(t){this.node&&(this.node.style.color=t);}},{key:"setFontColor",value:function(t){return this.fontColor=t,this}},{key:"setStyle",value:function(t,e){return this.node?(this.node.style[t]=e,this):this}},{key:"getStyle",value:function(t){if(this.node)return this.node.style[t]}},{key:"scrollToBottom",value:function(){return this.node?(this.node.scrollTop=this.node.scrollHeight,this):this}},{key:"setEnabled",value:function(t){return this.node?(void 0===t&&(t=!0),this.node.disabled=!t,this):this}},{key:"setBlur",value:function(){return this.node?(this.node.blur(),this):this}},{key:"setFocus",value:function(){return this.node?(this.node.focus(),this):this}},{key:"isFocused",get:function(){return this.isOpened}}]),i}(mo);Object.assign(Vl.prototype,Fl);var Yl=function(t,e,i){t=t.replace(" ","");var n=i.previousText;if(t===n)return t;if(isNaN(t)){i.emit("nan",t,i),t=n;var s=i.cursorPosition-1;i.setText(t),i.setCursorPosition(s);}else i.previousText=t;return t},Gl=function(t){var e=t.prevSelectionStart;if(null!==e){for(var i=t.prevSelectionEnd,n=t.parent,s=e;s<i;s++){var r=n.getCharChild(s);r&&n.emit("cursorout",r,s,n);}t.prevSelectionStart=null,t.prevSelectionEnd=null;}},Xl=function(t){var e=t.prevCursorPosition;if(null!==e){var i=t.parent,n=i.getCharChild(e);n&&i.emit("cursorout",n,e,i),t.prevCursorPosition=null;}},Hl=Phaser.Utils.Objects.GetValue,Ul=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).setSelectAllWhenFocusEnable(Hl(n,"selectAll",!1)),s.cursorMoveStartIndex=null,s.prevCursorPosition=null,s.prevSelectionStart=null,s.prevSelectionEnd=null,s.firstClickAfterOpen=!1,e.on("pointerdown",(function(t,i,n,s){var r=e.getNearestChild(i,n),o=e.getCharIndex(r);this.selectAllWhenFocus&&this.firstClickAfterOpen||this.setCursorPosition(o),this.cursorMoveStartIndex=o,this.firstClickAfterOpen=!1;}),v(s)).on("pointermove",(function(t,i,n,s){if(t.isDown){var r=e.getNearestChild(i,n),o=e.getCharIndex(r);this.cursorMoveStartIndex<o?this.selectText(this.cursorMoveStartIndex,o+1):this.selectText(o,this.cursorMoveStartIndex+1);}}),v(s)),s.on("open",(function(){this.selectAllWhenFocus&&this.selectAll(),this.firstClickAfterOpen=!0,e.emit("open");}),v(s)).on("close",(function(){e.emit("close");})).on("keydown-ENTER",(function(){e.emit("keydown-ENTER");})),s}return d(i,e),u(i,[{key:"initText",value:function(){var t=this.parent;return this.prevCursorPosition=null,this.setText(t.text),this}},{key:"updateText",value:function(){var t=this.parent,e=this.text;if(this.onUpdateCallback){var i=this.onUpdateCallback(e,t,this);null!=i&&(e=i);}return t.text!==e&&t.setText(e),this.isOpened?this.selectionStart!==this.selectionEnd?(Xl(this),function(t){var e=t.parent,i=t.isOpened?t.selectionStart:null,n=t.isOpened?t.selectionEnd:null,s=t.prevSelectionStart,r=t.prevSelectionEnd;if(s!==i||r!==n){var o,a;null===s?(o=i,a=n):null===i?(o=s,a=r):(o=Math.min(s,i),a=Math.max(r,n));for(var h=o;h<a;h++){var l;if((l=null!==s&&h>=s&&h<r)!=(null!==i&&h>=i&&h<n)){var u=e.getCharChild(h);if(u){var c=l?"cursorout":"cursorin";e.emit(c,u,h,e);}}}t.prevSelectionStart=i,t.prevSelectionEnd=n;}}(this)):(Gl(this),function(t){var e=t.parent,i=e.text,n=t.cursorPosition;if(t.prevCursorPosition!==n){var s;null!==t.prevCursorPosition&&t.prevCursorPosition>i.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=n&&(s=e.getCharChild(n))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,n=t.parent,s=n.width,r=n.height,o=t.drawX,a=t.drawY,h=o+t.drawTLX,l=o+t.drawTRX,u=a+t.drawTLY,c=a+t.drawBLY;e=h<0?0-h:l>s?s-l:0,i=u<0?0-u:c>r?r-c:0,n._textOX+=e,n._textOY+=i;}(s),e.emit("cursorin",s,n,e)),e.emit("movecursor",n,t.prevCursorPosition,e),t.prevCursorPosition=n;}}(this)):(Gl(this),Xl(this)),this}},{key:"setNumberInput",value:function(){return this.onUpdateCallback=Yl,this}},{key:"setSelectAllWhenFocusEnable",value:function(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}}]),i}(Vl),Nl=Phaser.Utils.Objects.GetValue,Kl=["inputType","onOpen","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"],Jl=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,s=0;s<i.length;s++){if(!n.hasOwnProperty(i[s]))return !1;n=n[i[s]];}return !0}return !1}return !1},ql=function(t,e,i,n){if(void 0===i&&(i="."),void 0===n&&(n={}),!t)return n;if(e in t)return Object.assign(n,t[e]);for(var s in e+=i,t)s.startsWith(e)&&(n[s.replace(e,"")]=t[s]);return n},Zl=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var n=0,s=e.length;n<s;n++)i[r=e[n]]=t[r];else for(var r in e)i[r]=t[r];return i},$l=function(t,e){for(var i in t){if(!(i in e))return !1;if(t[i]!==e[i])return !1}for(var i in e)if(!(i in t))return !1;return !0},Ql=function(t){kr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=Zl(t.style,e);$l(e,i)||(t.styleSave=i,t.modifyStyle(e));}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0);}),this);},tu=function(t){kr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=Zl(t,e);$l(e,i)||(t.styleSave=i,t.modifyStyle(e));}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0);}),this);};function eu(){}function iu(t,e,i,n,s){for(var r=0,o=e.length,a=0,h=0;r<o;r++){var l=e[r];if(l.removed){if(l.value=t.join(n.slice(h,h+l.count)),h+=l.count,r&&e[r-1].added){var u=e[r-1];e[r-1]=e[r],e[r]=u;}}else {if(!l.added&&s){var c=i.slice(a,a+l.count);c=c.map((function(t,e){var i=n[h+e];return i.length>t.length?i:t})),l.value=t.join(c);}else l.value=t.join(i.slice(a,a+l.count));a+=l.count,l.added||(h+=l.count);}}var d=e[o-1];return o>1&&"string"==typeof d.value&&(d.added||d.removed)&&t.equals("",d.value)&&(e[o-2].value+=d.value,e.pop()),e}eu.prototype={diff:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.callback;"function"==typeof i&&(n=i,i={}),this.options=i;var s=this;function r(t){return n?(setTimeout((function(){n(void 0,t);}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));var o=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,h=1,l=o+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));var u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=o&&c+1>=a)return r([{value:this.join(e),count:e.length}]);function d(){for(var i=-1*h;i<=h;i+=2){var n=void 0,l=u[i-1],c=u[i+1],d=(c?c.newPos:0)-i;l&&(u[i-1]=void 0);var f=l&&l.newPos+1<o,p=c&&0<=d&&d<a;if(f||p){if(!f||p&&l.newPos<c.newPos?(n={newPos:(v=c).newPos,components:v.components.slice(0)},s.pushComponent(n.components,void 0,!0)):((n=l).newPos++,s.pushComponent(n.components,!0,void 0)),d=s.extractCommon(n,e,t,i),n.newPos+1>=o&&d+1>=a)return r(iu(s,n.components,e,t,s.useLongestToken));u[i]=n;}else u[i]=void 0;}var v;h++;}if(n)!function t(){setTimeout((function(){if(h>l)return n();d()||t();}),0);}();else for(;h<=l;){var f=d();if(f)return f}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i});},extractCommon:function(t,e,i,n){for(var s=e.length,r=i.length,o=t.newPos,a=o-n,h=0;o+1<s&&a+1<r&&this.equals(e[o+1],i[a+1]);)o++,a++,h++;return h&&t.components.push({count:h}),t.newPos=o,a},equals:function(t,e){return this.options.comparator?this.options.comparator(t,e):t===e||this.options.ignoreCase&&t.toLowerCase()===e.toLowerCase()},removeEmpty:function(t){for(var e=[],i=0;i<t.length;i++)t[i]&&e.push(t[i]);return e},castInput:function(t){return t},tokenize:function(t){return t.split("")},join:function(t){return t.join("")}};var nu=new eu;var su=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,ru=/\S/,ou=new eu;ou.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!ru.test(t)&&!ru.test(e)},ou.tokenize=function(t){for(var e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),i=0;i<e.length-1;i++)!e[i+1]&&e[i+2]&&su.test(e[i])&&su.test(e[i+2])&&(e[i]+=e[i+2],e.splice(i+1,2),i--);return e};var au=new eu;au.tokenize=function(t){var e=[],i=t.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(var n=0;n<i.length;n++){var s=i[n];n%2&&!this.options.newlineIsToken?e[e.length-1]+=s:(this.options.ignoreWhitespace&&(s=s.trim()),e.push(s));}return e},(new eu).tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)},(new eu).tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};var hu=Object.prototype.toString,lu=new eu;function uu(t,e,i,n,s){var r,a;for(e=e||[],i=i||[],n&&(t=n(s,t)),r=0;r<e.length;r+=1)if(e[r]===t)return i[r];if("[object Array]"===hu.call(t)){for(e.push(t),a=new Array(t.length),i.push(a),r=0;r<t.length;r+=1)a[r]=uu(t[r],e,i,n,s);return e.pop(),i.pop(),a}if(t&&t.toJSON&&(t=t.toJSON()),"object"===o(t)&&null!==t){e.push(t),a={},i.push(a);var h,l=[];for(h in t)t.hasOwnProperty(h)&&l.push(h);for(l.sort(),r=0;r<l.length;r+=1)a[h=l[r]]=uu(t[h],e,i,n,h);e.pop(),i.pop();}else a=t;return a}lu.useLongestToken=!0,lu.tokenize=au.tokenize,lu.castInput=function(t){var e=this.options,i=e.undefinedReplacement,n=e.stringifyReplacer,s=void 0===n?function(t,e){return void 0===e?i:e}:n;return "string"==typeof t?t:JSON.stringify(uu(t,null,null,s),s,"  ")},lu.equals=function(t,e){return eu.prototype.equals.call(lu,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};var cu=new eu;cu.tokenize=function(t){return t.slice()},cu.join=cu.removeEmpty=function(t){return t};var du=Phaser.Utils.Array.Remove,fu=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),du(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var n=(h=i,l=e,nu.diff(h,l,u)),s=0,r=0,o=n.length;r<o;r++){var a=n[r];a.removed?t.removeText(s,a.count):a.added?(t.insertText(s,a.value),s+=a.count):s+=a.count;}var h,l,u;t.children.push(t.lastInsertCursor),t.runWrap(),t.emit("textchange",e,t);}},pu=Phaser.Utils.Objects.IsPlainObject,vu=function(e){function i(e,n,s,r,o,a){var l;h(this,i),pu(n)?a=n:pu(r)&&(a=r),void 0===a&&(a={}),function(t){var e=!t.textArea;if(Jl(t,"wrap.vAlign")||Q(t,"wrap.vAlign",i=e?"center":"top"),Jl(t,"wrap.charWrap")||Q(t,"wrap.charWrap",!0),Jl(t,"wrap.maxLines")||Q(t,"wrap.maxLines",i=e?1:void 0),e&&Q(t,"wrap.wrapWidth",1/0),Jl(t,"wrap.useDefaultTextHeight")||Q(t,"wrap.useDefaultTextHeight",!0),t.edit||(t.edit={}),!Jl(t.edit,"inputType")){var i=e?"text":"textarea";Q(t.edit,"inputType",i);}}(a);var u=a.text;u&&delete a.text;var c=ql(a.background,"focus"),d=ql(a.style,"cursor");(l=t(this,i,[e,n,s,r,o,a])).type="rexCanvasInput",l.contentWidth=void 0,l.contentHeight=void 0,l.lineHeight=void 0,l.linesCount=void 0,l._text,l.textEdit=function(t,e){var i=Nl(e,"edit");return void 0===i&&(i={}),Pl(e,i,Kl),new Ul(t,i)}(v(l),a),a.focusStyle&&Object.assign(c,a.focusStyle),tu.call(v(l),c),a.cursorStyle&&Object.assign(d,a.cursorStyle),Ql.call(v(l),d);var f=a.onAddChar;f&&l.on("addchar",f);var p=a.onCursorOut;p&&l.on("cursorout",p);var g=a.onCursorIn;g&&l.on("cursorin",g);var y,m,k=a.onMoveCursor;return k&&l.on("movecursor",k),l.setParseTextCallback(a.parseTextCallback),l.lastInsertCursor=(y=v(l),(m=y.createCharChild("|")).text="",m),u||(u=""),l.setText(u),l}return d(i,e),u(i,[{key:"addChild",value:function(t,e){if(m(f(i.prototype),"addChild",this).call(this,t,e),Array.isArray(t))for(var n=t,s=0,r=n.length;s<r;s++){t=n[s];ws(t)&&this.emit("addchar",t,e+s,this);}else ws(t)&&this.emit("addchar",t,e,this);return this}},{key:"text",get:function(){return this._text},set:function(t){t=null==t?"":t.toString(),this._text!==t&&(fu(this,t),this._text=t);}},{key:"setText",value:function(t){return this.text=t,this}},{key:"appendText",value:function(t){return this.setText(this.text+t),this}},{key:"runWrap",value:function(t){var e=m(f(i.prototype),"runWrap",this).call(this,t);return this.contentWidth=e.maxLineWidth,this.contentHeight=e.linesHeight,this.lineHeight=e.lineHeight,this.linesCount=e.lines.length,e}},{key:"setSize",value:function(t,e){return this.width===t&&this.height===e||(m(f(i.prototype),"setSize",this).call(this,t,e),this.runWrap()),this}},{key:"displayText",get:function(){return this.text},set:function(t){this.text=t;}},{key:"setDisplayText",value:function(t){return this.displayText=t,this}},{key:"inputText",get:function(){return this.textEdit.text},set:function(t){this.textEdit.text=t;}},{key:"setInputText",value:function(t){return this.inputText=t,this}},{key:"setParseTextCallback",value:function(t){return t||(t=gu),this.parseTextCallback=t,this}},{key:"value",get:function(){return this.parseTextCallback(this.text)},set:function(t){this.setText(t);}},{key:"getValue",value:function(){return this.value}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"readOnly",get:function(){return this.textEdit.readOnly},set:function(t){this.textEdit.readOnly=t;}},{key:"setReadOnly",value:function(t){return this.textEdit.setReadOnly(t),this}},{key:"open",value:function(t){return t&&this.textEdit.once("close",t),this.textEdit.open(),this}},{key:"close",value:function(){return this.textEdit.close(),this}},{key:"isOpened",get:function(){return this.textEdit.isOpened}},{key:"setFocusStyle",value:function(t){return this.focusStyle=t,this}},{key:"setCursorStyle",value:function(t){return this.cursorStyle=t,this}},{key:"setNumberInput",value:function(){return this.textEdit.setNumberInput().setSelectAllWhenFocusEnable(),this.parseTextCallback=Number,this}},{key:"maxLength",get:function(){return this.textEdit.maxLength},set:function(t){this.textEdit.maxLength=t;}},{key:"setMaxLength",value:function(t){return this.maxLength=t,this}},{key:"minLength",get:function(){return this.textEdit.minLength},set:function(t){this.textEdit.minLength=t;}},{key:"setMinLength",value:function(t){return this.minLength=t,this}},{key:"topTextOY",get:function(){return 0}},{key:"bottomTextOY",get:function(){return -this.tableVisibleHeight}},{key:"leftTextOX",get:function(){return 0}},{key:"rightTextOX",get:function(){return -this.textVisibleWidth}},{key:"textVisibleHeight",get:function(){var t=this.contentHeight-this.height;return t<0&&(t=0),t}},{key:"textVisibleWidth",get:function(){var t=this.contentWidth-this.width;return t<0&&(t=0),t}},{key:"t",get:function(){return this.getTextOYPercentage()},set:function(t){this.setTextOYByPercentage(t).updateTexture();}},{key:"s",get:function(){return this.getTextOXPercentage()},set:function(t){this.setTextOXByPercentage(t).updateTexture();}}]),i}(pr),gu=function(t){return t};Object.assign(vu.prototype,{setTextOYByPercentage:function(t){return this.setTextOY(-this.textVisibleHeight*t),this},getTextOYPercentage:function(){var t=this.textVisibleHeight;return 0===t?0:this._textOY/-t},setTextOXByPercentage:function(t){return this.setTextOX(-this.textVisibleWidth*t),this},getTextOXPercentage:function(){var t=this.textVisibleWidth;return 0===t?0:this._textOX/-t}}),E.register("canvasInput",(function(t,e,i,n,s){var r=new vu(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.CanvasInput",vu);var yu=function(t){return U(t).loop.delta},mu=Phaser.Utils.Objects.GetValue,ku=Phaser.Math.Wrap,bu=function(e){function i(e,n){var s;return h(this,i),void 0===n&&(n={}),"number"===n.onUpdate&&(n.onUpdate=Yl),(s=t(this,i,[e,n])).setCursor(mu(n,"cursor","|")),s.setCursorFlashDuration(mu(n,"cursorFlashDuration",1e3)),s.cursorFlashTimer=0,s}return d(i,e),u(i,[{key:"initText",value:function(){return this.cursorFlashTimer=0,this.prevCursorPosition=void 0,this.setText(this.parent.text),this.setCursorPosition(),this}},{key:"updateText",value:function(){var t=this.parent,e=this.text;if(this.onUpdateCallback){var i=this.onUpdateCallback(e,t,this);null!=i&&(e=i);}if(this.isOpened&&this.hasCursor){var n=this.cursorPosition;e=e.substring(0,n)+this.cursor+e.substring(n),this.prevCursorPosition!==n&&(this.prevCursorPosition=n);}return t.text!==e&&(t.setText(e),this.emit("textchange",e,t,this)),this}},{key:"setCursor",value:function(t){return this._cursor=t,this.hasCursor=t&&""!==t,t}},{key:"setCursorFlashDuration",value:function(t){return this.cursorFlashDuration=t,this}},{key:"cursor",get:function(){if(!this._isFocused)return this._cursor;var t;t=this.cursorFlashTimer<this.cursorFlashDuration/2?this._cursor:" ";var e=this.cursorFlashTimer+yu(this.scene);return this.cursorFlashTimer=ku(e,0,this.cursorFlashDuration),t}}]),i}(Vl);E.register("hiddenEdit",(function(t,e){return new bu(t,e)})),Q(window,"RexPlugins.UI.HiddenEdit",bu);var xu=Phaser.GameObjects.GetCalcMatrix,Cu=Phaser.Renderer.Canvas.SetTransform,wu={renderWebGL:function(t,e,i,n){e.updateData(),i.addToRenderList(e);var s=t.pipelines.set(e.pipeline),r=xu(e,i,n),o=s.calcMatrix.copyFrom(r.calc),a=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u,c=e.geom,d=0,f=c.length;d<f;d++)(u=c[d]).visible&&u.webglRender(s,o,l,a,h);t.pipelines.postBatch(e);},renderCanvas:function(t,e,i,n){e.updateData(),i.addToRenderList(e);var s=t.currentContext;if(Cu(t,s,e,i,n)){for(var r,o=e._displayOriginX,a=e._displayOriginY,h=e.geom,l=0,u=h.length;l<u;l++)(r=h[l]).visible&&r.canvasRender(s,o,a);s.restore();}}},Su=Phaser.GameObjects.Shape,Pu=Phaser.Utils.Array.Remove,Tu=function(e){function i(e,n,s,r,o){var a;return h(this,i),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=2),void 0===o&&(o=r),(a=t(this,i,[e,"rexShapes",[]]))._width=-1,a._height=-1,a.dirty=!0,a.isSizeChanged=!0,a.shapes={},a.setPosition(n,s),a.setSize(r,o),a.updateDisplayOrigin(),a}return d(i,e),u(i,[{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height);}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t);}},{key:"setDirty",value:function(t){return void 0===t&&(t=!0),this.dirty=t,this}},{key:"setSize",value:function(t,e){this.isSizeChanged=this.isSizeChanged||this._width!==t||this._height!==e,this.dirty=this.dirty||this.isSizeChanged,this._width=t,this._height=e,this.updateDisplayOrigin();var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"fillColor",get:function(){return this._fillColor},set:function(t){this.setFillStyle(t,this._fillAlpha);}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this.setFillStyle(this._fillColor,t);}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.fillColor!==t||this.fillAlpha!==e,this._fillColor=t,this._fillAlpha=e,this}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this.setStrokeStyle(t,this._strokeColor,this._strokeAlpha);}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this.setStrokeStyle(this._lineWidth,t,this._strokeAlpha);}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this.setStrokeStyle(this._lineWidth,this._strokeColor,t);}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.lineWidth!==t||this.strokeColor!==e||this.strokeAlpha!==i,this._lineWidth=t,this._strokeColor=e,this._strokeAlpha=i,this}},{key:"updateShapes",value:function(){}},{key:"updateData",value:function(){if(!this.dirty)return this;this.updateShapes();for(var t=this.geom,e=0,i=t.length;e<i;e++){var n=t[e];n.dirty&&n.updateData();}return this.isSizeChanged=!1,this.dirty=!1,this}},{key:"clear",value:function(){return this.geom.length=0,St(this.shapes),this}},{key:"getShape",value:function(t){return this.shapes[t]}},{key:"getShapes",value:function(){return this.geom}},{key:"addShape",value:function(t){this.geom.push(t);var e=t.name;return e&&(this.shapes[e]=t),this.dirty=!0,this}},{key:"deleteShape",value:function(t){var e=this.getShape(t);return e&&(delete this.shapes[t],Pu(this.geom,e)),this}}]),i}(Su);Object.assign(Tu.prototype,wu);var Ou={setBoxFillStyle:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle:function(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle:function(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape:function(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},Mu={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},Eu=function(){function t(){h(this,t),this.name=void 0,this.dirty=!0,this.visible=!0,this.data=void 0,this.isFilled=!1,this.fillColor=void 0,this.fillAlpha=1,this.isStroked=!1,this.lineWidth=1,this.strokeColor=void 0,this.strokeAlpha=1;}return u(t,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"reset",value:function(){return this.setVisible().fillStyle().lineStyle(),this}},{key:"webglRender",value:function(t,e,i,n,s){}},{key:"canvasRender",value:function(t,e,i){}},{key:"updateData",value:function(){this.dirty=!1;}}]),t}();Object.assign(Eu.prototype,Mu,Pt);var _u=Phaser.Geom.Polygon.Earcut,Ru=function(e){function i(){var e;return h(this,i),(e=t(this,i)).pathData=[],e.pathIndexes=[],e.closePath=!1,e}return d(i,e),u(i,[{key:"updateData",value:function(){return this.pathIndexes=_u(this.pathData),m(f(i.prototype),"updateData",this).call(this),this}},{key:"webglRender",value:function(t,e,i,n,s){this.isFilled&&Jt(t,e,this,i,n,s),this.isStroked&&Zt(t,this,i,n,s);}},{key:"canvasRender",value:function(t,e,i){var n=this.pathData,s=n.length-1,r=n[0]-e,o=n[1]-i;t.beginPath(),t.moveTo(r,o),this.closePath||(s-=2);for(var a=2;a<s;a+=2){var h=n[a]-e,l=n[a+1]-i;t.lineTo(h,l);}this.closePath&&t.closePath(),this.isFilled&&(Qt(t,this),t.fill()),this.isStroked&&(te(t,this),t.stroke());}}]),i}(Eu),Lu=Phaser.Math.DegToRad,Bu=function(e){function i(e,n,s,r,o,a,l,u){var c;return h(this,i),void 0===e&&(e=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=360),void 0===l&&(l=!1),void 0===u&&(u=!1),(c=t(this,i)).setCenterPosition(e,n),c.setRadius(s,r),c.setAngle(o,a,l),c.setPie(u),c.setIterations(32),c}return d(i,e),u(i,[{key:"x",get:function(){return this._x},set:function(t){this.dirty=this.dirty||this._x!==t,this._x=t;}},{key:"y",get:function(){return this._y},set:function(t){this.dirty=this.dirty||this._y!==t,this._y=t;}},{key:"setCenterPosition",value:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this}},{key:"radiusX",get:function(){return this._radiusX},set:function(t){this.dirty=this.dirty||this._radiusX!==t,this._radiusX=t;}},{key:"radiusY",get:function(){return this._radiusY},set:function(t){this.dirty=this.dirty||this._radiusY!==t,this._radiusY=t;}},{key:"setRadius",value:function(t,e){return void 0===e&&(e=t),this.radiusX=t,this.radiusY=e,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!==t,this._startAngle=t;}},{key:"endAngle",get:function(){return this._endAngle},set:function(t){this.dirty=this.dirty||this._endAngle!==t,this._endAngle=t;}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!==t,this._anticlockwise=t;}},{key:"setAngle",value:function(t,e,i){return void 0===i&&(i=!1),this.startAngle=t,this.endAngle=e,this.anticlockwise=i,this}},{key:"pie",get:function(){return this._pie},set:function(t){this.dirty=this.dirty||this._pie!==t,this._pie=t;}},{key:"setPie",value:function(t){return void 0===t&&(t=!0),this.pie=t,this}},{key:"iterations",get:function(){return this._iterations},set:function(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t;}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"updateData",value:function(){return this.pathData.length=0,this.pie&&this.pathData.push(this.x,this.y),Nt(this.x,this.y,this.radiusX,this.radiusY,this.startAngle,this.endAngle,this.anticlockwise,this.iterations,this.pathData),this.pie&&this.pathData.push(this.x,this.y),this.pathData.push(this.pathData[0],this.pathData[1]),m(f(i.prototype),"updateData",this).call(this),this}},{key:"canvasRender",value:function(t,e,i){t.beginPath();var n=this.x-e,s=this.y-i,r=Lu(this.startAngle),o=Lu(this.endAngle);this.pie&&(t.moveTo(n,s),t.lineTo(n+Math.cos(r)*this.radiusX,s+Math.sin(r)*this.radiusY)),t.ellipse(n,s,this.radiusX,this.radiusY,0,r,o,this.anticlockwise),this.pie&&t.lineTo(n,s),this.isFilled&&(Qt(t,this),t.fill()),this.isStroked&&(te(t,this),t.stroke());}}]),i}(Ru),Du=function(e){function i(e,n,s){return h(this,i),t(this,i,[e,n,s,s,0,360])}return d(i,e),u(i)}(Bu),Iu=function(e){function i(e){var n;return h(this,i),(n=t(this,i)).setCurve(e),n.setIterations(32),n}return d(i,e),u(i,[{key:"curve",get:function(){return this._curve},set:function(t){this.dirty=this.dirty||this._curve!==t,this._curve=t;}},{key:"setCurve",value:function(t){return this.curve=t,this}},{key:"iterations",get:function(){return this._iterations},set:function(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t;}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"updateData",value:function(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,n=t.length;e<n;e++)this.pathData.push(t[e].x,t[e].y);return this.pathData.push(t[0].x,t[0].y),m(f(i.prototype),"updateData",this).call(this),this}}]),i}(Ru),ju=function(e){function i(e,n,s,r){return h(this,i),t(this,i,[e,n,s,r,0,360])}return d(i,e),u(i)}(Bu),zu=function(e){function i(e,n,s,r){var o;return h(this,i),void 0===e&&(e=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),(o=t(this,i)).setP0(e,n),o.setP1(s,r),o}return d(i,e),u(i,[{key:"x0",get:function(){return this._x0},set:function(t){this.dirty=this.dirty||this._x0!==t,this._x0=t;}},{key:"y0",get:function(){return this._y0},set:function(t){this.dirty=this.dirty||this._y0!==t,this._y0=t;}},{key:"setP0",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"x1",get:function(){return this._x1},set:function(t){this.dirty=this.dirty||this._x1!==t,this._x1=t;}},{key:"y1",get:function(){return this._y1},set:function(t){this.dirty=this.dirty||this._y1!==t,this._y1=t;}},{key:"setP1",value:function(t,e){return this.x1=t,this.y1=e,this}},{key:"updateData",value:function(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x0,this.y0),m(f(i.prototype),"updateData",this).call(this),this}}]),i}(Ru),Au=Phaser.Math.Interpolation.QuadraticBezier,Fu=Phaser.Math.Interpolation.CubicBezier,Wu=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],n=t[e-1];return t.push(i),t.push(n),t},Vu={clear:function(){return this.start(),this},start:function(){return this.startAt(),this},startAt:function(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e);}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo:function(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),Ht(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo:function(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo:function(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc:function(t,e,i,n,s,r,o){return void 0===o&&(o=!1),Nt(t,e,i,n,s,r,o,this.iterations,this.pathData),this.lastPointX=this.pathData[this.pathData.length-2],this.lastPointY=this.pathData[this.pathData.length-1],this},arc:function(t,e,i,n,s,r){return this.ellipticalArc(t,e,i,i,n,s,r),this},quadraticBezierTo:function(t,e,i,n){return function(t,e,i,n,s,r){for(var o=r.length,a=r[o-2],h=r[o-1],l=1,u=s-1;l<=u;l++){var c=l/u;r.push(Au(c,a,t,i),Au(c,h,e,n));}}(t,e,i,n,this.iterations,this.pathData),this.lastPointX=i,this.lastPointY=n,this.lastCX=t,this.lastCY=e,this},smoothQuadraticBezierTo:function(t,e){var i=2*this.lastPointX-this.lastCX,n=2*this.lastPointY-this.lastCY;return this.quadraticBezierTo(i,n,t,e),this},cubicBezierCurveTo:function(t,e,i,n,s,r){return function(t,e,i,n,s,r,o,a){for(var h=a.length,l=a[h-2],u=a[h-1],c=1,d=o-1;c<=d;c++){var f=c/d;a.push(Fu(f,l,t,i,s),Fu(f,u,e,n,r));}}(t,e,i,n,s,r,this.iterations,this.pathData),this.lastPointX=s,this.lastPointY=r,this.lastCX=i,this.lastCY=n,this},smoothCubicBezierCurveTo:function(t,e,i,n){var s=2*this.lastPointX-this.lastCX,r=2*this.lastPointY-this.lastCY;return this.cubicBezierCurveTo(s,r,t,e,i,n),this},close:function(){var t=this.pathData[0],e=this.pathData[1];return t===this.lastPointX&&e===this.lastPointY||this.lineTo(t,e),this.closePath=!0,this},end:function(){return Wu(this.pathData),this}},Yu=Phaser.Math.RotateAround,Gu=function(t,e,i){for(var n=0,s=i.length-1;n<s;n+=2)i[n]+=t,i[n+1]+=e;return i},Xu=Phaser.Math.DegToRad,Hu=Phaser.Math.RotateAround,Uu={rotateAround:function(t,e,i){if(0===this.pathData.length)return this;!function(t,e,i,n){for(var s={x:0,y:0},r=0,o=n.length-1;r<o;r+=2)s.x=n[r],s.y=n[r+1],Yu(s,t,e,i),n[r]=s.x,n[r+1]=s.y;}(t,e,i=Xu(i),this.pathData);var n=this.pathData.length;if(this.lastPointX=this.pathData[n-2],this.lastPointY=this.pathData[n-1],void 0!==this.lastCX){var s={x:this.lastCX,y:this.lastCY};Hu(s,t,e,i),this.lastCX=s.x,this.lastCY=s.y;}return this},scale:function(t,e,i,n){if(0===this.pathData.length)return this;if(function(t,e,i,n,s){for(var r=0,o=s.length-1;r<o;r+=2){var a=s[r]-t,h=s[r+1]-e;a*=i,h*=n,s[r]=a+t,s[r+1]=h+e;}}(t,e,i,n,this.pathData),this.lastPointX=this.pathData[pathDataCnt-2],this.lastPointY=this.pathData[pathDataCnt-1],void 0!==this.lastCX){var s=this.lastCX-t,r=this.lastCY-e;s*=i,r*=n,this.lastCX=s+t,this.lastCY=r+e;}return this},offset:function(t,e){return Gu(t,e,this.pathData),this}},Nu=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=e.length),t.length=n-i;for(var s=0,r=t.length;s<r;s++)t[s]=e[s+i];return t},Ku={savePathData:function(){return this.pathDataSaved||(this.pathDataSave=w(this.pathData),this.pathData.length=0,this.pathDataSaved=!0),this},restorePathData:function(){return this.pathDataSaved?(Nu(this.pathData,this.pathDataSave),this.pathDataSave=void 0,this.pathDataSaved=!1,this):this}},Ju=Phaser.Math.Distance.Between,qu=Phaser.Math.Wrap,Zu=Phaser.Math.Linear,$u=function(t,e,i,n,s){if(void 0===n&&(n=i,i=0),(i=ec(i))!==(n=ec(n))){var r=e[e.length-1],o=r*i,a=r*n;i<n?Qu(t,e,o,a,s):(Qu(t,e,o,r,s),Qu(t,e,0,a,s)),Wu(s);}},Qu=function(t,e,i,n,s){for(var r=i>0,o=0,a=e.length;o<a;o++){var h=2*o,l=e[o];if(r){if(l<i)continue;if(l==i)r=!1;else {var u=1-(l-i)/(l-e[o-1]);s.push(tc(t,h-2,h,u)),s.push(tc(t,h-1,h+1,u)),r=!1;}}if(!(l<=n)){u=1-(l-n)/(l-e[o-1]);s.push(tc(t,h-2,h,u)),s.push(tc(t,h-1,h+1,u));break}if(s.push(t[h]),s.push(t[h+1]),l===n)break}},tc=function(t,e,i,n){var s=t[e],r=t[i];return Zu(s,r,n)},ec=function(t){return 0===t?0:t%1==0?1:qu(t,0,1)},ic={updateAccumulationLengths:function(){if(null==this.accumulationLengths)this.accumulationLengths=[];else if(this.accumulationLengths.length===this.pathData.length/2)return this;for(var t,e,i,n,s=this.accumulationLengths,r=this.pathData,o=0,a=0,h=r.length;a<h;a+=2)i=r[a],n=r[a+1],o+=void 0===t?0:Ju(t,e,i,n),s.push(o),t=i,e=n;return this.totalPathLength=o,this},setDisplayPathSegment:function(t,e){return this.pathDataSaved||(this.updateAccumulationLengths(),this.savePathData()),this.pathData.length=0,$u(this.pathDataSave,this.accumulationLengths,t,e,this.pathData),this},appendFromPathSegment:function(t,e,i){var n;void 0===e?(n=this.pathData).push.apply(n,w(t.pathData)):(t.updateAccumulationLengths(),$u(t.pathData,t.accumulationLengths,e,i,this.pathData));return this.firstPointX=this.pathData[0],this.firstPointY=this.pathData[1],this.lastPointX=this.pathData[this.pathData.length-2],this.lastPointY=this.pathData[this.pathData.length-1],this}},nc=Phaser.Geom.Polygon,sc=function(){function t(e){h(this,t),void 0===e&&(e=[]),this.pathData=e,this.closePath=!1,this.setIterations(32),this.firstPointX=void 0,this.firstPointY=void 0,this.lastPointX=void 0,this.lastPointY=void 0,this.accumulationLengths=void 0;}return u(t,[{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"toPoints",value:function(){return function(t,e){void 0===e&&(e=[]);for(var i=0,n=t.length-1;i<n;i+=2)e.push({x:t[i],y:t[i+1]});return e}(this.pathData)}},{key:"toPolygon",value:function(t){return function(t,e){return void 0===e&&(e=new nc),e.setTo(t),e}(this.pathData,t)}}]),t}();Object.assign(sc.prototype,Vu,Uu,Ku,ic,{draw:function(t,e,i){var n=this.toPoints();return e&&t.fillPoints(n,this.closePath,this.closePath),i&&t.strokePoints(n,this.closePath,this.closePath),this}});var rc=function(e){function i(){var e;return h(this,i),(e=t(this,i)).builder=new sc(e.pathData),e}return d(i,e),u(i,[{key:"iterations",get:function(){return this.builder.iterations},set:function(t){this.dirty=this.dirty||this.builder.iterations!==t,this.builder.setIterations(t);}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"lastPointX",get:function(){return this.builder.lastPointX}},{key:"lastPointY",get:function(){return this.builder.lastPointY}},{key:"start",value:function(){return this.builder.start(),this.dirty=!0,this}},{key:"startAt",value:function(t,e){return this.builder.startAt(t,e),this.dirty=!0,this}},{key:"lineTo",value:function(t,e,i){return this.builder.lineTo(t,e,i),this.dirty=!0,this}},{key:"verticalLineTo",value:function(t,e){return this.builder.verticalLineTo(t,e),this.dirty=!0,this}},{key:"horizontalLineTo",value:function(t,e){return this.builder.horizontalLineTo(t,e),this.dirty=!0,this}},{key:"ellipticalArc",value:function(t,e,i,n,s,r,o){return this.builder.ellipticalArc(t,e,i,n,s,r,o),this.dirty=!0,this}},{key:"arc",value:function(t,e,i,n,s,r){return this.builder.arc(t,e,i,n,s,r),this.dirty=!0,this}},{key:"quadraticBezierTo",value:function(t,e,i,n){return this.builder.quadraticBezierTo(t,e,i,n),this.dirty=!0,this}},{key:"smoothQuadraticBezierTo",value:function(t,e){return this.builder.smoothQuadraticBezierTo(t,e),this.dirty=!0,this}},{key:"cubicBezierCurveTo",value:function(t,e,i,n,s,r){return this.builder.cubicBezierCurveTo(t,e,i,n,s,r),this.dirty=!0,this}},{key:"smoothCubicBezierCurveTo",value:function(t,e,i,n){return this.builder.smoothCubicBezierCurveTo(t,e,i,n),this.dirty=!0,this}},{key:"close",value:function(){return this.builder.close(),this.closePath=this.builder.closePath,this.dirty=!0,this}},{key:"end",value:function(){return this.builder.end(),this.dirty=!0,this}},{key:"rotateAround",value:function(t,e,i){return this.builder.rotateAround(t,e,i),this.dirty=!0,this}},{key:"scale",value:function(t,e,i,n){return this.builder.scale(t,e,i,n),this.dirty=!0,this}},{key:"offset",value:function(t,e){return this.builder.offset(t,e),this.dirty=!0,this}},{key:"toPolygon",value:function(t){return this.builder.toPolygon(t)}},{key:"appendPathFrom",value:function(t,e,i){return this.builder.appendFromPathSegment(t.builder,e,i),this}},{key:"copyPathFrom",value:function(t,e,i){return this.builder.clear().appendFromPathSegment(t.builder,e,i),this}},{key:"setDisplayPathSegment",value:function(t,e){return this.builder.setDisplayPathSegment(t,e),this}}]),i}(Ru),oc=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha,ac=function(e){function i(e,n,s,r){var o;return h(this,i),void 0===e&&(e=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=s),(o=t(this,i)).pathData=[],o.closePath=!0,o.setTopLeftPosition(e,n),o.setSize(s,r),o}return d(i,e),u(i,[{key:"x",get:function(){return this._x},set:function(t){this.dirty=this.dirty||this._x!==t,this._x=t;}},{key:"y",get:function(){return this._y},set:function(t){this.dirty=this.dirty||this._y!==t,this._y=t;}},{key:"setTopLeftPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"width",get:function(){return this._width},set:function(t){this.dirty=this.dirty||this._width!==t,this._width=t;}},{key:"height",get:function(){return this._height},set:function(t){this.dirty=this.dirty||this._height!==t,this._height=t;}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"centerX",get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2;}},{key:"centerY",get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2;}},{key:"setCenterPosition",value:function(t,e){return this.centerX=t,this.centerY=e,this}},{key:"updateData",value:function(){this.pathData.length=0;var t=this.x,e=t+this.width,n=this.y,s=n+this.height;return this.pathData.push(t,n),this.pathData.push(e,n),this.pathData.push(e,s),this.pathData.push(t,s),this.pathData.push(t,n),m(f(i.prototype),"updateData",this).call(this),this}},{key:"webglRender",value:function(t,e,i,n,s){if(this.isFilled){var r=t.fillTint,o=oc(this.fillColor,this.fillAlpha*i);r.TL=o,r.TR=o,r.BL=o,r.BR=o,t.batchFillRect(-n+this.x,-s+this.y,this.width,this.height);}this.isStroked&&Zt(t,this,i,n,s);}},{key:"canvasRender",value:function(t,e,i){this.isFilled&&(Qt(t,this),t.fillRect(-e,-i,this.width,this.height)),this.isStroked&&(te(t,this),t.beginPath(),t.rect(-e,-i,this.width,this.height),t.stroke());}}]),i}(Eu),hc=Phaser.Utils.Objects.GetValue,lc=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),void 0===e&&(e=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=s),void 0===o&&(o=0),void 0===a&&(a=6),(l=t(this,i)).setTopLeftPosition(e,n),l.setSize(s,r),l.setRadius(o),l.setIterations(a),l.closePath=!0,l}return d(i,e),u(i,[{key:"x",get:function(){return this._x},set:function(t){this.dirty=this.dirty||this._x!==t,this._x=t;}},{key:"y",get:function(){return this._y},set:function(t){this.dirty=this.dirty||this._y!==t,this._y=t;}},{key:"setTopLeftPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"width",get:function(){return this._width},set:function(t){this.dirty=this.dirty||this._width!==t,this._width=t;}},{key:"height",get:function(){return this._height},set:function(t){this.dirty=this.dirty||this._height!==t,this._height=t;}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"centerX",get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2;}},{key:"centerY",get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2;}},{key:"setCenterPosition",value:function(t,e){return this.centerX=t,this.centerY=e,this}},{key:"radiusTL",get:function(){return this._radiusTL},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t);}},{key:"radiusTR",get:function(){return this._radiusTR},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t);}},{key:"radiusBL",get:function(){return this._radiusBL},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t);}},{key:"radiusBR",get:function(){return this._radiusBR},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t);}},{key:"radius",get:function(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)},set:function(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=hc(t,"tl",0),this.radiusTR=hc(t,"tr",0),this.radiusBL=hc(t,"bl",0),this.radiusBR=hc(t,"br",0));}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"iterations",get:function(){return this._iterations},set:function(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t;}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"updateData",value:function(){var t=this.pathData;t.length=0;var e,n=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?Nt(e,e,e,e,180,270,!1,r,t):Nt(0,0,e,e,90,0,!0,r,t):Ht(0,0,t);(e=this.radiusTR)>0?this._convexTR?Nt(n-e,e,e,e,270,360,!1,r,t):Nt(n,0,e,e,180,90,!0,r,t):Ht(n,0,t);(e=this.radiusBR)>0?this._convexBR?Nt(n-e,s-e,e,e,0,90,!1,r,t):Nt(n,s,e,e,270,180,!0,r,t):Ht(n,s,t);(e=this.radiusBL)>0?this._convexBL?Nt(e,s-e,e,e,90,180,!1,r,t):Nt(0,s,e,e,360,270,!0,r,t):Ht(0,s,t);return t.push(t[0],t[1]),Gu(this.x,this.y,t),m(f(i.prototype),"updateData",this).call(this),this}}]),i}(Ru),uc=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha,cc=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),void 0===e&&(e=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=0),(l=t(this,i)).pathData=[],l.closePath=!0,l.setP0(e,n),l.setP1(s,r),l.setP2(o,a),l}return d(i,e),u(i,[{key:"x0",get:function(){return this._x0},set:function(t){this.dirty=this.dirty||this._x0!==t,this._x0=t;}},{key:"y0",get:function(){return this._y0},set:function(t){this.dirty=this.dirty||this._y0!==t,this._y0=t;}},{key:"setP0",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"x1",get:function(){return this._x1},set:function(t){this.dirty=this.dirty||this._x1!==t,this._x1=t;}},{key:"y1",get:function(){return this._y1},set:function(t){this.dirty=this.dirty||this._y1!==t,this._y1=t;}},{key:"setP1",value:function(t,e){return this.x1=t,this.y1=e,this}},{key:"x2",get:function(){return this._x2},set:function(t){this.dirty=this.dirty||this._x2!==t,this._x2=t;}},{key:"y2",get:function(){return this._y2},set:function(t){this.dirty=this.dirty||this._y2!==t,this._y2=t;}},{key:"setP2",value:function(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}},{key:"updateData",value:function(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),m(f(i.prototype),"updateData",this).call(this),this}},{key:"webglRender",value:function(t,e,i,n,s){if(this.isFilled){var r=uc(this.fillColor,this.fillAlpha*i),o=this.x0-n,a=this.y0-s,h=this.x1-n,l=this.y1-s,u=this.x2-n,c=this.y2-s,d=e.getX(o,a),f=e.getY(o,a),p=e.getX(h,l),v=e.getY(h,l),g=e.getX(u,c),y=e.getY(u,c);t.batchTri(d,f,p,v,g,y,r,r,r);}this.isStroked&&Zt(t,this,i,n,s);}},{key:"canvasRender",value:function(t,e,i){var n=this.x1-e,s=this.y1-i,r=this.x2-e,o=this.y2-i,a=this.x3-e,h=this.y3-i;t.beginPath(),t.moveTo(n,s),t.lineTo(r,o),t.lineTo(a,h),t.closePath(),this.isFilled&&(Qt(t,this),t.fill()),this.isStroked&&(te(t,this),t.stroke());}}]),i}(Eu),dc={buildShapes:function(){this.addShape((new lc).setName("box")).addShape((new rc).setName("checker"));},updateShapes:function(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),n=2*i,s=t-i,r=e-i,o=this.boxLineWidth,a=Math.max(n/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var u=n*(1-this.boxSize)/2,c=o/2,d=n*this.boxSize-o;h.setTopLeftPosition(s+c+u,r+c+u).setSize(d,d),this.isCircleShape?h.setRadius(d/2):h.setRadius(0);u=n*(1-this.checkerSize)/2;var f=n*this.checkerSize/4,p=1*f,v=2*f,g=3*f;l.startAt(p,v).lineTo(v,g).lineTo(g,p).offset(s+u,r+u).end();}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(o,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(a,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(o,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress);}},fc=Phaser.Utils.Objects.GetValue,pc=Phaser.Math.Linear,vc=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).resetFromJSON(),s.boot(),s}return d(i,e),u(i,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=fc(t,"key","value");var n=e[this.propertyKey];return this.fromValue=fc(t,"from",n),this.toValue=fc(t,"to",n),this.setEase(fc(t,"ease",this.ease)),this.setDuration(fc(t,"duration",this.duration)),this.setRepeat(fc(t,"repeat",0)),this.setDelay(fc(t,"delay",0)),this.setRepeatDelay(fc(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,m(f(i.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=pc(this.fromValue,this.toValue,i);}}]),i}(zo),gc={setCheckerAnimationDuration:function(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation:function(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new vc(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation:function(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},yc={};Object.assign(yc,Ou,{setBoxSize:function(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize:function(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},dc,gc);var mc=Phaser.Utils.Objects.GetValue,kc=Phaser.Utils.Objects.IsPlainObject,bc=23730,xc=function(e){function i(e,n,s,r,o,a,l){var u;h(this,i),kc(n)?(n=mc(l=n,"x",0),s=mc(l,"y",0),r=mc(l,"width",2),o=mc(l,"height",2),a=mc(l,"color",bc)):kc(a)&&(a=mc(l=a,"color",bc)),(u=t(this,i,[e,n,s,r,o])).type="rexCheckbox",void 0===a&&(a=bc),u.setBoxShape(mc(l,"circleBox",!1)),u.setBoxFillStyle(a,mc(l,"boxFillAlpha",1)),u.setUncheckedBoxFillStyle(mc(l,"uncheckedColor",null),mc(l,"uncheckedBoxFillAlpha",1)),u.setBoxStrokeStyle(mc(l,"boxLineWidth",4),mc(l,"boxStrokeColor",a),mc(l,"boxStrokeAlpha",1)),u.setUncheckedBoxStrokeStyle(u.boxLineWidth,mc(l,"uncheckedBoxStrokeColor",u.boxStrokeColor),mc(l,"uncheckedBoxStrokeAlpha",u.boxStrokeAlpha)),u.setCheckerStyle(mc(l,"checkerColor",16777215),mc(l,"checkerAlpha",1)),u.setBoxSize(mc(l,"boxSize",1)),u.setCheckerSize(mc(l,"checkerSize",1)),u.setCheckerAnimationDuration(mc(l,"animationDuration",150)),u.buildShapes();var c=mc(l,"checked");return void 0===c&&(c=mc(l,"value",!1)),u.setValue(c),u}return d(i,e),u(i,[{key:"value",get:function(){return this._value},set:function(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t));}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"toggleValue",value:function(){return this.setValue(!this.value),this}},{key:"checked",get:function(){return this.value},set:function(t){this.value=t;}},{key:"setChecked",value:function(t){return void 0===t&&(t=!0),this.setValue(t),this}},{key:"toggleChecked",value:function(){return this.toggleValue(),this}},{key:"checkerAnimProgress",get:function(){return this._checkerAnimProgress},set:function(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0);}}]),i}(Tu);Object.assign(xc.prototype,yc);var Cc=Phaser.Utils.Objects.GetValue,wc=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n]))._enable=void 0,e.setInteractive(Cc(n,"inputConfig",void 0)),s.resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(Cc(t,"enable",!0)),this.setMode(Cc(t,"mode",1)),this.setClickInterval(Cc(t,"clickInterval",100)),this.setDragThreshold(Cc(t,"threshold",void 0)),this}},{key:"boot",value:function(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.pointer=null,m(f(i.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Sc[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"onPress",value:function(t,e,i,n){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,n),0===this.mode&&this.click(t.downTime,t,n));}},{key:"onRelease",value:function(t,e,i,n){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,n),1===this.mode&&this.click(t.upTime,t,n),this.pointer=void 0);}},{key:"onPointOut",value:function(t,e){this.pointer===t&&this.cancel();}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel();}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}},{key:"click",value:function(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),i}(mo),Sc={press:0,pointerdown:0,release:1,pointerup:1},Pc=Phaser.Utils.Objects.GetValue,Tc=function(e){function i(e,n,s,r,o,a,l){var u;return h(this,i),(u=t(this,i,[e,n,s,r,o,a,l]))._click=new wc(v(u),Pc(l,"click")),u._click.on("click",(function(){this.toggleValue();}),v(u)),u.setReadOnly(Pc(l,"readOnly",!1)),u}return d(i,e),u(i,[{key:"readOnly",get:function(){return !this._click.enable},set:function(t){this._click.enable=!t;}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}}]),i}(xc);E.register("checkbox",(function(t,e,i,n,s,r){var o=new Tc(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Q(window,"RexPlugins.UI.Checkbox",Tc);var Oc={setTrackFillStyle:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},Mc={setTrackSize:function(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius:function(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize:function(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius:function(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},Ec={setThumbPosition:function(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},_c=function(t,e,i){return (e-t)*i+t},Rc=Phaser.Math.Linear,Lc={buildShapes:function(){this.addShape((new lc).setName("track")).addShape((new lc).setName("thumb"));},updateShapes:function(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,n=this.getShape("track");if(this.isSizeChanged){var s=t*this.trackWidth,r=e*this.trackHeight,o=(t-s)/2,a=(e-r)/2,h=e*this.trackRadius;n.setTopLeftPosition(o,a).setSize(s,r).setRadius(h);}var l,u,c,d=(l=this.falseValueTrackColor,u=this.trackFillColor,c=i,(255&_c(Mr(l),Mr(u),c))<<16|(255&_c(Er(l),Er(u),c))<<8|255&_c(_r(l),_r(u),c)),f=Rc(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);n.fillStyle(d,f);var p=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,g=e*this.thumbHeight,y=e*this.thumbRadius;p.setSize(v,g).setRadius(y);}var m=Rc(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(m=t-m);var k=e/2;p.setCenterPosition(m,k),p.fillStyle(this.thumbColor,this.thumbAlpha);}},Bc={setToggleAnimationDuration:function(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation:function(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new vc(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation:function(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},Dc={};Object.assign(Dc,Oc,Mc,Ec,Lc,Bc);var Ic=Phaser.Utils.Objects.GetValue,jc=Phaser.Utils.Objects.IsPlainObject,zc=23730,Ac=function(e){function i(e,n,s,r,o,a,l){var u;h(this,i),jc(n)?(n=Ic(l=n,"x",0),s=Ic(l,"y",0),r=Ic(l,"width",2),o=Ic(l,"height",2),a=Ic(l,"color",zc)):jc(a)&&(a=Ic(l=a,"color",zc)),(u=t(this,i,[e,n,s,r,o])).type="rexToggleSwitch",void 0===a&&(a=zc),u.setTrackFillStyle(a,Ic(l,"trackFillAlpha",1)),u.setFalseValueTrackFillStyle(Ic(l,"falseValueTrackColor",function(t){var e=.3*Mr(t)+.59*Er(t)+.11*_r(t);return (255&e)<<16|(255&e)<<8|255&e}(a)),Ic(l,"falseValueTrackFillAlpha",1)),u.setThumbStyle(Ic(l,"thumbColor",16777215),Ic(l,"thumbAlpha",1)),u.setTrackSize(Ic(l,"trackWidth",.9),Ic(l,"trackHeight",.5)),u.setTrackRadius(Ic(l,"trackRadius",.5*u.trackHeight));var c=Ic(l,"thumbHeight",void 0),d=Ic(l,"thumbWidth",c);return void 0===d&&(d=.9*u.trackHeight),u.setThumbSize(d,c),u.setThumbRadius(Ic(l,"thumbRadius",.5*u.thumbHeight)),u.setThumbPosition(Ic(l,"thumbLeft",.3),Ic(l,"thumbRight",void 0)),u.setRTL(Ic(l,"rtl",!1)),u.setToggleAnimationDuration(Ic(l,"animationDuration",150)),u.buildShapes(),u.setValue(Ic(l,"value",!1),0),u}return d(i,e),u(i,[{key:"value",get:function(){return this._value},set:function(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t));}},{key:"setValue",value:function(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}},{key:"toggleValue",value:function(t){return this.setValue(!this.value,t),this}},{key:"toggleAnimProgress",get:function(){return this._toggleAnimProgress},set:function(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0);}}]),i}(Tu);Object.assign(Ac.prototype,Dc);var Fc=Phaser.Utils.Objects.GetValue,Wc=function(e){function i(e,n,s,r,o,a,l){var u;return h(this,i),(u=t(this,i,[e,n,s,r,o,a,l]))._click=new wc(v(u),Fc(l,"click")),u._click.on("click",(function(){this.toggleValue();}),v(u)),u.setReadOnly(Fc(l,"readOnly",!1)),u}return d(i,e),u(i,[{key:"readOnly",get:function(){return !this._click.enable},set:function(t){this._click.enable=!t;}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}}]),i}(Ac);E.register("toggleSwitch",(function(t,e,i,n,s,r){var o=new Wc(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Q(window,"RexPlugins.UI.ToggleSwitch",Wc);var Vc={loadFromURL:function(t,e){var i=this,n=new Image;return n.onload=function(){i.width!==n.width||i.height!==n.height?i.resize(n.width,n.height):i.clear(),i.context.drawImage(n,0,0),i.updateTexture(),e&&e(),n.onload=null,n.src="",n.remove();},n.src=t,this},loadFromURLPromise:function(t){var e=this;return new Promise((function(i,n){e.loadFromURL(t,i);}))},loadFromFile:function(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e();})),this},loadFromFilePromise:function(t){var e=this;return new Promise((function(i,n){e.loadFromFile(t,i);}))}},Yc=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i)}(ke);Object.assign(Yc.prototype,Vc),E.register("canvas",(function(t,e,i,n){var s=new Yc(this.scene,t,e,i,n);return this.scene.add.existing(s),s})),Q(window,"RexPlugins.UI.Canvas",Yc);var Gc=Phaser.Utils.Objects.GetValue,Xc=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),(l=t(this,i,[e,n,s])).type="rexCircleMaskImage",l.setTexture(r,o,a),l}return d(i,e),u(i,[{key:"setTexture",value:function(t,e,i){"object"===o(e)&&(i=e,e=void 0),"string"==typeof i&&(i={maskType:i});var n=Gc(i,"maskType",0),s=Gc(i,"backgroundColor",void 0),r=Gc(i,"strokeColor",void 0),a=Gc(i,"strokeWidth",null!=r?10:0);if(void 0===n?n=0:"string"==typeof n&&(n=Hc[n]),this._textureKey=t,this._frameName=e,null===n)return this.loadTexture(t,e),this.dirty=!0,this;var h=this.scene.sys.textures.getFrame(t,e);if(!h)return this;h.cutWidth!==this.width||h.cutHeight!==this.height?this.setCanvasSize(h.cutWidth,h.cutHeight):this.clear();var l=this.canvas,u=this.context,c=l.width,d=l.height;null!=s&&(u.fillStyle=s,u.fillRect(0,0,c,d)),u.save(),u.beginPath();var f=a/2;switch(n){case 1:var p=(m=Math.floor(c/2))-f,v=(k=Math.floor(d/2))-f;u.ellipse(m,k,p,v,0,0,2*Math.PI);break;case 2:var g=Gc(i,"radius",0),y=Gc(i,"iteration",void 0);Se(u,f,f,c-a,d-a,g,y);break;default:var m=Math.floor(c/2),k=Math.floor(d/2),b=Math.min(m,k)-f;u.arc(m,k,b,0,2*Math.PI);}return null!=r&&(u.strokeStyle=r,u.lineWidth=a,u.stroke()),u.clip(),this.loadTexture(t,e),u.restore(),this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setDisplaySize(t,e),this}}]),i}(ke),Hc={circle:0,ellipse:1,roundRectangle:2};E.register("circleMaskImage",(function(t,e,i,n,s){var r=new Xc(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.CircleMaskImage",Xc);var Uc=Phaser.Utils.Objects.GetValue,Nc=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),(l=t(this,i,[e,n,s])).type="rexAlphaMaskImage",l.maskFrame=null,l.setTexture(r,o,a),l}return d(i,e),u(i,[{key:"setTexture",value:function(t,e,i){"object"===o(e)&&(i=e,e=void 0),"string"==typeof i&&(i={mask:{key:i}});var n=Uc(i,"mask.key"),s=Uc(i,"mask.frame"),r=Uc(i,"mask.invertAlpha",!1),a=Uc(i,"mask.scale"),h=Uc(i,"backgroundColor");if(n){this._maskKey=n,this._maskFrame=s,this._maskScale=a;var l=n?this.scene.sys.textures.get(n):null;this.maskFrame=l?l.get(s):null;}this._textureKey=t,this._frameName=e;var u=this.maskFrame;if(null===u)return this.loadTexture(t,e),this.dirty=!0,this;var c=null!=h;this.loadTexture(t,e);var d,f,p=this.canvas,v=this.context,g=p.width,y=p.height;v.save(),v.globalCompositeOperation=r?"destination-out":"destination-in",null!=this._maskScale?(d=u.cutWidth*this._maskScale,f=u.cutHeight*this._maskScale):(d=g,f=y);var m=(g-d)/2,k=(y-f)/2;return this.drawFrame(this._maskKey,this._maskFrame,m,k,d,f),v.restore(),c&&(v.save(),v.globalCompositeOperation="destination-over",v.fillStyle=h,v.fillRect(0,0,g,y),v.restore()),this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setDisplaySize(t,e),this}}]),i}(ke);E.register("alphaMaskImage",(function(t,e,i,n,s){var r=new Nc(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.AlphaMaskImage",Nc);var Kc=Phaser.Math.Linear,Jc=Phaser.Math.Percent,qc={setValue:function(t,e,i){return null==t||(void 0!==e&&(t=Jc(t,e,i)),this.value=t),this},addValue:function(t,e,i){return void 0!==e&&(t=Jc(t,e,i)),this.value+=t,this},getValue:function(t,e){var i=this.value;return void 0!==t&&(i=Kc(t,e,i)),i}},Zc=Phaser.Math.Percent,$c={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Zc(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new vc(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,n){return void 0===i&&(i=-1),void 0===n&&(n=0),void 0===this.easeValueTask&&(this.easeValueTask=new vc(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:n}),this}},Qc=Phaser.Utils.Objects.GetValue,td=Phaser.Math.Clamp;function ed(e){var i=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"bootProgressBase",value:function(t){this.eventEmitter=Qc(t,"eventEmitter",this);var e=Qc(t,"valuechangeCallback",null);if(null!==e){var i=Qc(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i);}return this.setEaseValuePropName("value").setEaseValueDuration(Qc(t,"easeValue.duration",0)).setEaseValueFunction(Qc(t,"easeValue.ease","Linear")),this}},{key:"value",get:function(){return this._value},set:function(t){t=td(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter);}}]),i}(e);return Object.assign(i.prototype,qc,$c),i}var id=Phaser.Math.RadToDeg,nd=Phaser.Math.DegToRad,sd=function(t,e,i,n,s,r,o,a){var h=360===Math.abs(o-r),l=nd(r),u=nd(o),c=Math.cos(l),d=Math.sin(l),f=Math.cos(u),p=Math.sin(u);return t.startAt(e+c*n,i+d*n),t.arc(e,i,n,r,o,a),h&&0===s||(t.lineTo(e+f*s,i+p*s),s>0&&t.arc(e,i,s,o,r,!a)),t.close(),t},rd={buildShapes:function(){this.addShape((new rc).setName("track")).addShape((new rc).setName("bar")).addShape((new Du).setName("center"));},updateShapes:function(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,n=i-e,s=this.getShape("track");null!=this.trackColor&&this.thickness>0?(s.fillStyle(this.trackColor),sd(s,t,t,i,n,0,360,!1)):s.reset();var r=this.getShape("bar");if(null!=this.barColor&&this.thickness>0){var o,a,h;if(1===this.value)o=!1,a=0,h=360;else o=this.anticlockwise,a=id(this.startAngle),h=360*(o?1-this.value:this.value)+a;r.fillStyle(this.barColor),sd(r,t,t,i,n,a,h,!1);}else r.reset();var l=this.getShape("center");this.centerColor&&n>0?l.setCenterPosition(t,t).setRadius(n).fillStyle(this.centerColor):l.reset();}},od=Phaser.Utils.Objects.GetValue,ad=Phaser.Utils.Objects.IsPlainObject,hd=Phaser.Math.Clamp,ld=Phaser.Math.DegToRad(270),ud=function(e){function i(e,n,s,r,o,a,l){var u;h(this,i),ad(n)&&(n=od(l=n,"x",0),s=od(l,"y",0),r=od(l,"radius",1),o=od(l,"barColor",void 0),a=od(l,"value",0)),void 0===r&&(r=1);var c=2*r;return (u=t(this,i,[e,n,s,c,c])).type="rexCircularProgress",u.bootProgressBase(l),u.setRadius(r),u.setTrackColor(od(l,"trackColor",void 0)),u.setBarColor(o),u.setCenterColor(od(l,"centerColor",void 0)),u.setThickness(od(l,"thickness",.2)),u.setStartAngle(od(l,"startAngle",ld)),u.setAnticlockwise(od(l,"anticlockwise",!1)),u.buildShapes(),u.setValue(a),u}return d(i,e),u(i,[{key:"resize",value:function(t,e){return (t=Math.floor(Math.min(t,e)))===this.width||(m(f(i.prototype),"resize",this).call(this,t,t),this.setRadius(t/2)),this}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e);}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"trackColor",get:function(){return this._trackColor},set:function(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t;}},{key:"setStartAngle",value:function(t){return this.startAngle=t,this}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t;}},{key:"setAnticlockwise",value:function(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}},{key:"thickness",get:function(){return this._thickness},set:function(t){t=hd(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t;}},{key:"setThickness",value:function(t){return this.thickness=t,this}},{key:"centerColor",get:function(){return this._centerColor},set:function(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t;}},{key:"setCenterColor",value:function(t){return this.centerColor=t,this}}]),i}(ed(Tu));Object.assign(ud.prototype,rd),E.register("circularProgress",(function(t,e,i,n,s,r){var o=new ud(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Q(window,"RexPlugins.UI.CircularProgress",ud);var cd=function(t,e,i,n,s,r,o,a,h,l,u,c){void 0===l&&(l=0),void 0===u&&(u=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,n,s,r,0,l,u,c),null!=o&&(e.fillStyle=o,e.fill()),null!=a&&(e.strokeStyle=a,e.lineWidth=h,e.stroke());},dd=Phaser.Math.PI2,fd=function(){var t,e=this.radius,i=this.thickness*this.radius,n=this.radius-i/2,s=this.radius-i,r=(this.canvas,this.context),o=this.anticlockwise,a=this.startAngle,h=this.endAngle,l=this._deltaAngle;if(this.trackColor&&i>0&&(r.save(),cd(0,r,e,e,n,n,void 0,this.trackColor,i,a,h,o),r.restore()),this.barColor&&n>0){var u,c;if(u=o?(a-l*this.value+dd)%dd:(a+l*this.value)%dd,r.save(),this.barColor2){var d=e+n*Math.cos(a),f=e+n*Math.sin(a),p=e+n*Math.cos(u),v=e+n*Math.sin(u),g=r.createLinearGradient(d,f,p,v);g.addColorStop(0,this.barColor2),g.addColorStop(1,this.barColor),c=g;}else c=this.barColor;cd(0,r,e,e,n,n,void 0,c,i,a,u,o),r.restore();}this.centerColor&&s>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,s)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,r.save(),cd(0,r,e,e,s,s,t),r.restore());this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(r.save(),function(t,e,i,n,s,r,o,a,h,l,u){void 0===h&&null!=a&&(h=2),void 0===l&&(l="start"),void 0===u&&(u="alphabetic"),e.font=r,e.textAlign=l,e.textBaseline=u,e.fillStyle=o,e.strokeStyle=a,e.lineWidth=h,e.lineCap="round",e.lineJoin="round",null!=a&&"none"!==a&&h>0&&e.strokeText(s,i,n),null!=o&&"none"!==o&&e.fillText(s,i,n);}(0,r,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),r.restore());},pd=Phaser.Utils.Objects.GetValue,vd=Phaser.Utils.Objects.IsPlainObject,gd=Phaser.Math.Angle.Normalize,yd=Phaser.Math.Clamp,md=Phaser.Math.DegToRad(270),kd=Phaser.Math.PI2,bd=function(e){function i(e,n,s,r,o,a,l){var u;h(this,i),vd(n)&&(n=pd(l=n,"x",0),s=pd(l,"y",0),r=pd(l,"radius",1),o=pd(l,"barColor",void 0),a=pd(l,"value",0));var c=2*r;(u=t(this,i,[e,n,s,c,c])).type="rexCircularProgressCanvas",u.bootProgressBase(l),u.setRadius(r),u.setTrackColor(pd(l,"trackColor",void 0)),u.setBarColor(o),u.setBarColor2(pd(l,"barColor2",void 0)),u.setCenterColor(pd(l,"centerColor",void 0)),u.setThickness(pd(l,"thickness",.2)),u.setStartAngle(pd(l,"startAngle",md)),u.setEndAngle(pd(l,"endAngle",u.startAngle+kd)),u.setAnticlockwise(pd(l,"anticlockwise",!1)),u.setTextColor(pd(l,"textColor",void 0)),u.setTextStrokeColor(pd(l,"textStrokeColor",void 0),pd(l,"textStrokeThickness",void 0));var d=pd(l,"textFont",void 0);return d?u.setTextFont(d):u.setTextFont(pd(l,"textSize","16px"),pd(l,"textFamily","Courier"),pd(l,"textStyle","")),u.setTextFormatCallback(pd(l,"textFormatCallback",void 0),pd(l,"textFormatCallbackScope",void 0)),u.setValue(a),u}return d(i,e),u(i,[{key:"resize",value:function(t,e){return (t=Math.floor(Math.min(t,e)))===this.width||(m(f(i.prototype),"resize",this).call(this,t,t),this.setRadius(t/2)),this}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e);}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"trackColor",get:function(){return this._trackColor},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"barColor2",get:function(){return this._barColor2},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t;}},{key:"setBarColor2",value:function(t){return this.barColor2=t,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){t=gd(t),this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t,this._deltaAngle=xd(this._startAngle,this._endAngle,this._anticlockwise);}},{key:"setStartAngle",value:function(t){return this.startAngle=t,this}},{key:"endAngle",get:function(){return this._endAngle},set:function(t){t=gd(t),this.dirty=this.dirty||this._endAngle!=t,this._endAngle=t,this._deltaAngle=xd(this._startAngle,this._endAngle,this._anticlockwise);}},{key:"setEndAngle",value:function(t){return this.endAngle=t,this}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t,this._deltaAngle=xd(this._startAngle,this._endAngle,this._anticlockwise);}},{key:"setAnticlockwise",value:function(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}},{key:"thickness",get:function(){return this._thickness},set:function(t){t=yd(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t;}},{key:"setThickness",value:function(t){return this.thickness=t,this}},{key:"centerColor",get:function(){return this._centerColor},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t;}},{key:"centerColor2",get:function(){return this._centerColor2},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t;}},{key:"setCenterColor",value:function(t,e){return this.centerColor=t,this.centerColor2=e,this}},{key:"textColor",get:function(){return this._textColor},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t;}},{key:"setTextColor",value:function(t){return this.textColor=t,this}},{key:"textStrokeColor",get:function(){return this._textStrokeColor},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t;}},{key:"textStrokeThickness",get:function(){return this._textStrokeThickness},set:function(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t;}},{key:"setTextStrokeColor",value:function(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}},{key:"textFont",get:function(){return this._textFont},set:function(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t;}},{key:"setTextFont",value:function(t,e,i){var n;return n=void 0===e?t:i+" "+t+" "+e,this.textFont=n,this}},{key:"setTextFormatCallback",value:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}},{key:"updateTexture",value:function(){return this.clear(),fd.call(this),m(f(i.prototype),"updateTexture",this).call(this),this}},{key:"getFormatText",value:function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}]),i}(ed(ke)),xd=function(t,e,i){return i?t<=e?kd+t-e:t-e:t>=e?kd+e-t:e-t};E.register("circularProgressCanvas",(function(t,e,i,n,s,r){var o=new bd(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Q(window,"RexPlugins.UI.CircularProgressCanvas",bd);var Cd=function(t,e,i,n,s,r){var o=(e+n)/2;return r>=0?t.startAt(o+r,i).lineTo(n+r,i).lineTo(n,s).lineTo(e,s).lineTo(e+r,i).lineTo(o+r,i):t.startAt(o,i).lineTo(n,i).lineTo(n-r,s).lineTo(e-r,s).lineTo(e,i).lineTo(o,i),t},wd=Phaser.Utils.Objects.GetValue,Sd=Phaser.Utils.Objects.IsPlainObject,Pd=function(e){function i(e,n,s,r,o,a,l,u){var c;return h(this,i),Sd(n)?(n=wd(u=n,"x",0),s=wd(u,"y",0),r=wd(u,"width",2),o=wd(u,"height",2),a=wd(u,"barColor",void 0),l=wd(u,"value",0)):Sd(r)?(r=wd(u=r,"width",2),o=wd(u,"height",2),a=wd(u,"barColor",void 0),l=wd(u,"value",0)):Sd(a)&&(a=wd(u=a,"barColor",void 0),l=wd(u,"value",0)),(c=t(this,i,[e,n,s,r,o,u])).type="rexLineProgress",c.bootProgressBase(u),c.addShape((new rc).setName("trackFill")).addShape((new rc).setName("bar")).addShape((new rc).setName("trackStroke")),c.setTrackColor(wd(u,"trackColor",void 0)),c.setBarColor(a),c.setTrackStroke(wd(u,"trackStrokeThickness",2),wd(u,"trackStrokeColor",void 0)),c.setSkewX(wd(u,"skewX",0)),c.setRTL(wd(u,"rtl",!1)),c.setValue(l),c}return d(i,e),u(i,[{key:"trackColor",get:function(){return this._trackColor},set:function(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"trackStrokeColor",get:function(){return this._trackStrokeColor},set:function(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t;}},{key:"trackStrokeThickness",get:function(){return this._trackStrokeThickness},set:function(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t;}},{key:"setTrackStroke",value:function(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"skewX",get:function(){return this._skewX},set:function(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t;}},{key:"setSkewX",value:function(t){return this.skewX=t,this}},{key:"rtl",get:function(){return this._rtl},set:function(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t;}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}}]),i}(ed(Tu)),Td={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,n=this.getShape("trackFill");n.fillStyle(this.trackColor),n.isFilled&&Cd(n,0,0,e,i,t).close();var s,r,o=this.getShape("bar");(o.fillStyle(this.barColor),o.isFilled)&&(this.rtl?(s=e*(1-this.value),r=e):(s=0,r=e*this.value),Cd(o,s,0,r,i,t).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Cd(a,0,0,e,i,t).end();}};Object.assign(Pd.prototype,Td),E.register("lineProgress",(function(t,e,i,n,s,r,o){var a=new Pd(this.scene,t,e,i,n,s,r,o);return this.scene.add.existing(a),a})),Q(window,"RexPlugins.UI.LineProgress",Pd);var Od=function(t,e,i,n,s,r,o){void 0===o&&(o="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var n=1,s=e.length;n<s;n++)i=e[n],t.lineTo(i.x,i.y);t.closePath(),t.restore();}(e,i),e.lineJoin=o,null!=n&&(e.fillStyle=n,e.fill()),null!=s&&(e.strokeStyle=s,e.lineWidth=r,e.stroke());},Md=function(){var t,e,i=this.skewX,n=this.width-Math.abs(i),s=this.height,r=(this.canvas,this.context);if((this.trackColor||this.trackStrokeColor)&&Ed(0,0,n,s,i,this.trackPoints),this.barColor&&(this.rtl?(t=n*(1-this.value),e=n):(t=0,e=n*this.value),Ed(t,0,e,s,i,this.barPoints)),this.trackColor&&(r.save(),Od(0,r,this.trackPoints,this.trackColor),r.restore()),this.barColor){var o;if(r.save(),this.barColor2){var a;if(this.isHorizontalGradient){var h=s/2;a=r.createLinearGradient(t,h,e,h);}else {var l=n/2;a=r.createLinearGradient(l,0,l,s);}a.addColorStop(0,this.rtl?this.barColor:this.barColor2),a.addColorStop(1,this.rtl?this.barColor2:this.barColor),o=a;}else o=this.barColor;Od(0,r,this.barPoints,o),r.restore();}this.trackStrokeColor&&this.trackStrokeThickness>0&&(r.save(),Od(0,r,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),r.restore());},Ed=function(t,e,i,n,s,r){void 0===r&&(r=[]),r.length=4;for(var o=0;o<4;o++)r[o]||(r[o]={});var a;return s>=0?((a=r[0]).x=t+s,a.y=e,(a=r[1]).x=i+s,a.y=e,(a=r[2]).x=i,a.y=n,(a=r[3]).x=t,a.y=n):((a=r[0]).x=t,a.y=e,(a=r[1]).x=i,a.y=e,(a=r[2]).x=i-s,a.y=n,(a=r[3]).x=t-s,a.y=n),r},_d=Phaser.Utils.Objects.GetValue,Rd=Phaser.Utils.Objects.IsPlainObject,Ld=function(e){function i(e,n,s,r,o,a,l,u){var c;return h(this,i),Rd(n)?(n=_d(u=n,"x",0),s=_d(u,"y",0),r=_d(u,"width",2),o=_d(u,"height",2),a=_d(u,"barColor",void 0),l=_d(u,"value",0)):Rd(r)?(r=_d(u=r,"width",2),o=_d(u,"height",2),a=_d(u,"barColor",void 0),l=_d(u,"value",0)):Rd(a)&&(a=_d(u=a,"barColor",void 0),l=_d(u,"value",0)),(c=t(this,i,[e,n,s,r,o])).type="rexLineProgressCanvas",c.trackPoints=[],c.barPoints=[],c.bootProgressBase(u),c.setTrackColor(_d(u,"trackColor",void 0)),c.setBarColor(a,_d(u,"barColor2",void 0),_d(u,"isHorizontalGradient",void 0)),c.setTrackStroke(_d(u,"trackStrokeThickness",2),_d(u,"trackStrokeColor",void 0)),c.setSkewX(_d(u,"skewX",0)),c.setRTL(_d(u,"rtl",!1)),c.setValue(l),c}return d(i,e),u(i,[{key:"trackColor",get:function(){return this._trackColor},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"trackStrokeColor",get:function(){return this._trackStrokeColor},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t;}},{key:"trackStrokeThickness",get:function(){return this._trackStrokeThickness},set:function(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t;}},{key:"setTrackStroke",value:function(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"barColor2",get:function(){return this._barColor2},set:function(t){t=Ce(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t;}},{key:"isHorizontalGradient",get:function(){return this._isHorizontalGradient},set:function(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t;}},{key:"setBarColor",value:function(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}},{key:"skewX",get:function(){return this._skewX},set:function(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t;}},{key:"setSkewX",value:function(t){return this.skewX=t,this}},{key:"rtl",get:function(){return this._rtl},set:function(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t;}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"updateTexture",value:function(){return this.clear(),Md.call(this),m(f(i.prototype),"updateTexture",this).call(this),this}}]),i}(ed(ke));E.register("circularProgressCanvas",(function(t,e,i,n,s,r,o){var a=new Ld(this.scene,t,e,i,n,s,r,o);return this.scene.add.existing(a),a})),Q(window,"RexPlugins.UI.LineProgressCanvas",Ld),Phaser.Math.Wrap;var Bd=Phaser.Math.Linear,Dd=function(){var t,e,i,n,s,r,o=this.getShape("triangle"),a=this.padding,h=this.width-a.right,l=0+a.left,u=this.height-a.bottom,c=0+a.top,d=(l+h)/2,f=(c+u)/2,p={0:{a:{x:l,y:c},b:{x:h,y:f},c:{x:l,y:u}},1:{a:{x:l,y:c},b:{x:d,y:u},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:f},c:{x:h,y:u}},3:{a:{x:l,y:u},b:{x:d,y:c},c:{x:h,y:u}}};if(void 0===this.previousDirection){var v=p[this.direction],g=v.a,y=v.b,m=v.c;t=g.x,e=g.y,i=y.x,n=y.y,s=m.x,r=m.y;}else {var k=p[this.previousDirection],b=p[this.direction],x=this.easeDirectionProgress;t=Bd(k.a.x,b.a.x,x),e=Bd(k.a.y,b.a.y,x),i=Bd(k.b.x,b.b.x,x),n=Bd(k.b.y,b.b.y,x),s=Bd(k.c.x,b.c.x,x),r=Bd(k.c.y,b.c.y,x);}o.startAt(t,e).lineTo(i,n).lineTo(s,r),this.arrowOnly?o.end():o.close();},Id=(0, Phaser.Math.DegToRad)(120),jd=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,n=Math.min(e,i)*this.radius,s=this.verticeRotation;t.startAt(e+n*Math.cos(s+Id),i+n*Math.sin(s+Id)).lineTo(e+n*Math.cos(s),i+n*Math.sin(s)).lineTo(e+n*Math.cos(s-Id),i+n*Math.sin(s-Id)),this.arrowOnly?t.end():t.close();},zd={buildShapes:function(){this.addShape((new rc).setName("triangle"));},updateShapes:function(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?Dd.call(this):jd.call(this);}},Ad={setEaseDuration:function(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation:function(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new vc(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection:function(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}},Fd=Phaser.Utils.Objects.GetValue,Wd=Phaser.Utils.Objects.IsPlainObject,Vd=Phaser.Math.DegToRad,Yd=Phaser.Math.RadToDeg,Gd=function(e){function i(e,n,s,r,o,a,l){var u,c,d,f,p,v,g,y,m;if(h(this,i),Wd(n)){var k=n;n=k.x,s=k.y,r=k.width,o=k.height,a=k.color,l=k.alpha,c=k.strokeColor,d=k.strokeAlpha,f=k.strokeWidth,p=k.arrowOnly,v=k.direction,g=k.easeDuration,y=k.padding,m=k.radius;}return void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=1),void 0===o&&(o=r),void 0===p&&(p=!1),void 0===v&&(v=0),void 0===g&&(g=0),void 0===y&&(y=0),void 0===m&&(m=void 0),(u=t(this,i,[e,n,s,r,o])).type="rexTriangle",u.setFillStyle(a,l),void 0!==c&&void 0===f&&(f=2),u.setStrokeStyle(f,c,d),u.setArrowOnly(p),u.setDirection(v,g),u.setPadding(y),u.setRadius(m),u.buildShapes(),u}return d(i,e),u(i,[{key:"arrowOnly",get:function(){return this._arrowOnly},set:function(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t;}},{key:"setArrowOnly",value:function(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}},{key:"direction",get:function(){return this._direction},set:function(t){t=Hd(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection());}},{key:"setDirection",value:function(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}},{key:"toggleDirection",value:function(t){return this.setDirection(this.direction+2,t),this}},{key:"easeDirectionProgress",get:function(){return this._easeDirectionProgress},set:function(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0);}},{key:"setPadding",value:function(t,e,i,n){if("object"===o(t)){var s=t,r=Fd(s,"x",null);null!==r?(t=r,i=r):(t=Fd(s,"left",0),i=Fd(s,"right",t));var a=Fd(s,"y",null);null!==a?(e=a,n=a):(e=Fd(s,"top",0),n=Fd(s,"bottom",e));}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===n&&(n=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=n,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=n,this.setRadius(),this}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;}},{key:"setRadius",value:function(t){return this.radius=t,this.shapeMode=null==t?0:1,this}},{key:"verticeRotation",get:function(){return this._verticeRotation},set:function(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t;}},{key:"setVerticeRotation",value:function(t){return this.verticeRotation=t,this}},{key:"verticeAngle",get:function(){return Yd(this.verticeRotation)},set:function(t){this.verticeRotation=Vd(t);}},{key:"setVerticeAngle",value:function(t){return this.verticeAngle=t,this}}]),i}(Tu),Xd={right:0,down:1,left:2,up:3},Hd=function(t){return "string"==typeof t&&(t=Xd[t]),t%=4};Object.assign(Gd.prototype,zd,Ad),E.register("triangle",(function(t,e,i,n,s,r){var o=new Gd(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Q(window,"RexPlugins.UI.Triangle",Gd),dt();var Ud=Phaser.GameObjects.Zone,Nd=Phaser.Utils.Array.Add,Kd=Phaser.Utils.Array.Remove,Jd=function(e){function i(e,n,s,r,o){var a;return h(this,i),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=1),void 0===o&&(o=1),(a=t(this,i,[e,n,s,r,o])).children=[],a}return d(i,e),u(i,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e,n=this.children.length-1;n>=0;n--)(e=this.children[n]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),m(f(i.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return Nd(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return Kd(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i<n;i++)(e=this.children[i]).off("destroy",this.onChildDestroy,this),t&&e.destroy();return this.children.length=0,this}}]),i}(Ud),qd=Phaser.GameObjects.Components;Phaser.Class.mixin(Jd,[qd.Alpha,qd.Flip]);var Zd,$d=function t(e,i){var n;if(void 0===i)e.hasOwnProperty("rexContainer")&&(n=e.rexContainer.parent);else for(n=t(e);n&&n.name!==i;)n=t(n);return n},Qd=function(t){for(var e=$d(t);e;)t=e,e=$d(e);return t},tf=Phaser.Math.DegToRad,ef=Phaser.Math.RadToDeg,nf=function(t){if(!t.hasOwnProperty("rexContainer")){var e={parent:null,self:null,layer:null,x:0,y:0,syncPosition:!0,rotation:0,syncRotation:!0,scaleX:0,scaleY:0,syncScale:!0,alpha:0,syncAlpha:!0,visible:!0,active:!0};Object.defineProperty(e,"angle",{get:function(){return ef(this.rotation)},set:function(t){this.rotation=tf(t);}}),Object.defineProperty(e,"displayWidth",{get:function(){return t.width*this.scaleX},set:function(e){this.scaleX=e/t.width;}}),Object.defineProperty(e,"displayHeight",{get:function(){return t.height*this.scaleY},set:function(e){this.scaleY=e/t.height;}}),t.rexContainer=e;}return t.rexContainer},sf={setParent:function(t,e){void 0===e&&(e=this);var i=nf(t);return e?(i.parent=e,i.self=t):(i.parent=null,i.self=null),this},getParent:function(t,e){return "string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),$d(t,e)},getTopmostParent:function(t){return void 0===t&&(t=this),Qd(t)}},rf=Phaser.Utils.Objects.GetValue,of=Jd.prototype.add,af=function(t,e){this.setParent(t);var i=nf(t);return lf(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),of.call(this,t),this.addToParentContainer(t),this.addToRenderLayer(t),this},hf=function(t,e){this.setParent(t);var i=nf(t);return lf(i,e),i.x=t.x,i.y=t.y,i.rotation=t.rotation,i.scaleX=t.scaleX,i.scaleY=t.scaleY,i.alpha=t.alpha,i.visible=t.visible,i.active=t.active,this.updateChildPosition(t).updateChildAlpha(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),of.call(this,t),this.addToRenderLayer(t),this},lf=function(t,e){void 0===e&&(e=!0),"boolean"==typeof e?(t.syncPosition=e,t.syncRotation=e,t.syncScale=e,t.syncAlpha=e,t.syncScrollFactor=e):(t.syncPosition=rf(e,"syncPosition",!0),t.syncRotation=rf(e,"syncRotation",!0),t.syncScale=rf(e,"syncScale",!0),t.syncAlpha=rf(e,"syncAlpha",!0),t.syncScrollFactor=rf(e,"syncScrollFactor",!0));},uf={add:function(t){return Array.isArray(t)?this.addMultiple(t):af.call(this,t),this},pin:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):af.call(this,t,e),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)af.call(this,t[e]);return this},addLocal:function(t){return Array.isArray(t)?this.addMultiple(t):hf.call(this,t),this},pinLocal:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):hf.call(this,t,e),this},addLocalMultiple:function(t){for(var e=0,i=t.length;e<i;e++)hf.call(this,t[e]);return this}},cf=Jd.prototype.remove,df=Jd.prototype.clear,ff={remove:function(t,e){return $d(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),cf.call(this,t,e)),this},unpin:function(t,e){return $d(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),cf.call(this,t,e)),this},clear:function(t){for(var e=this.children,i=0,n=e.length;i<n;i++){var s=e[i];this.setParent(s,null),t||this.removeFromRenderLayer(s);}return df.call(this,t),this}},pf={getLocalState:function(t){return nf(t)},resetChildState:function(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState:function(t){for(var e=0,i=t.length;e<i;e++)this.resetChildState(t[e]);return this},syncProperties:function(){return this.syncPosition().syncVisible().syncAlpha().syncActive().syncScrollFactor().syncMask(),this}},vf=Phaser.Math.RotateAround,gf={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,vf(t,0,0,-this.rotation),t.x/=this.scaleX,t.y/=this.scaleY,t},localToWorld:function(t){return t.x*=this.scaleX,t.y*=this.scaleY,vf(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},yf=function(t,e){return t===e?1:t/e},mf={updateChildPosition:function(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=nf(t),i=e.parent;return e.syncPosition&&(t.x=e.x,t.y=e.y,i.localToWorld(t)),e.syncRotation&&(t.rotation=e.rotation+i.rotation),e.syncScale&&(t.scaleX=e.scaleX*i.scaleX,t.scaleY=e.scaleY*i.scaleY),t.isRexContainerLite&&(t.syncChildrenEnable=!0,t.syncPosition()),this},syncPosition:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildPosition,this),this},resetChildPositionState:function(t){var e=nf(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=yf(t.scaleX,i.scaleX),e.scaleY=yf(t.scaleY,i.scaleY),e.rotation=t.rotation-i.rotation,this},setChildPosition:function(t,e,i){return t.x=e,t.y=i,this.resetChildPositionState(t),this},setChildLocalPosition:function(t,e,i){var n=nf(t);return n.x=e,n.y=i,this.updateChildPosition(t),this},resetLocalPositionState:function(){var t=nf(this).parent;return t&&t.resetChildPositionState(this),this}},kf=Phaser.Math.DegToRad,bf={updateChildRotation:function(t){var e=nf(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState:function(t){var e=nf(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation:function(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle:function(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation:function(t,e){return nf(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle:function(t,e){return nf(t).rotation=kf(e),this.updateChildRotation(t),this},resetLocalRotationState:function(){var t=nf(this).parent;return t&&t.resetChildRotationState(this),this}},xf={updateChildScale:function(t){var e=nf(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState:function(t){var e=nf(t),i=e.parent;return e.scaleX=yf(t.scaleX,i.scaleX),e.scaleY=yf(t.scaleY,i.scaleY),this},setChildScale:function(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale:function(t,e,i){void 0===i&&(i=e);var n=nf(t);return n.scaleX=e,n.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize:function(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState:function(){var t=nf(this).parent;return t&&t.resetChildScaleState(this),this}},Cf={updateChildVisible:function(t){var e=nf(t),i=e.parent,n=!e.hasOwnProperty("maskVisible")||e.maskVisible,s=!i||i.visible;return t.visible=s&&e.visible&&n,this},syncVisible:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState:function(t){var e=nf(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible:function(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible:function(t,e){return void 0===e&&(e=!0),nf(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible:function(t,e){return void 0===e&&(e=!0),nf(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState:function(){var t=nf(this).parent;return t&&t.resetChildVisibleState(this),this}},wf={updateChildAlpha:function(t){var e=nf(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState:function(t){var e=nf(t),i=e.parent;return e.alpha=yf(t.alpha,i.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha:function(t,e){return nf(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState:function(){var t=nf(this).parent;return t&&t.resetChildAlphaState(this),this}},Sf={updateChildActive:function(t){var e=nf(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState:function(t){return nf(t).active=t.active,this},setChildActive:function(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive:function(t,e){return void 0===e&&(e=!0),nf(t).active=e,this.updateChildActive(t),this},resetLocalActiveState:function(){var t=nf(this).parent;return t&&t.resetChildActiveState(this),this}},Pf={updateChildScrollFactor:function(t){var e=nf(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Tf={updateChildMask:function(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask:function(t){return this.mask=t,this},clearMask:function(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t);})),t&&this.mask&&this.mask.destroy(),this}},Of=function(t){return t.filter((function(t){return !!t.displayList||(!!t.parentContainer||void 0)}))},Mf={setDepth:function(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),n=0,s=i.length;n<s;n++)i[n].depth=t;return this},swapDepth:function(t){var e=this.depth,i=t.depth;return this.setDepth(i),t.setDepth(e),this},incDepth:function(t){if(this.depth+=t,this.children)for(var e=this.getAllChildren(),i=0,n=e.length;i<n;i++)e[i].depth+=t;return this},bringToTop:function(){var t=this.displayList,e=this.getAllChildren([this]);co(e,!1);for(var i=0,n=e.length;i<n;i++){var s=e[i];t.exists(s)&&t.bringToTop(s);}return this},moveDepthBelow:function(t){var e=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);co(i,!1);for(var n=0,s=i.length;n<s;n++){var r=i[n];if(e.exists(r)){e.moveBelow(t,r);break}}return this},moveDepthAbove:function(t){var e=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);co(i,!0);for(var n=0,s=i.length;n<s;n++){var r=i[n];if(e.exists(r)){e.moveAbove(t,r);break}}return this},bringChildToTop:function(t){var e;t.isRexContainerLite?(e=t.getAllChildren([t]),e=Of(e),e=co(e,!1)):e=[t];var i=this.getAllChildren([this]);i=Of(i);for(var n=(i=co(i,!1))[i.length-1],s=0,r=e.length;s<r;s++){var o=e[s];n!==o&&n.displayList===o.displayList&&(n.displayList.moveAbove(o,n),n=o);}return this},sendChildToBack:function(t){var e;t.isRexContainerLite?(e=t.getAllChildren([t]),e=Of(e),e=co(e,!1)):e=[t];var i=this.getAllChildren([this]);i=Of(i);for(var n=(i=co(i,!1))[0],s=e.length-1;s>=0;s--){var r=e[s];n!==r&&n.displayList===r.displayList&&(n.displayList.moveBelow(r,n),n=r);}return this}},Ef=function t(e,i){if(!i(e)&&e.isRexContainerLite)for(var n=e.children,s=0,r=n.length;s<r;s++)t(n[s],i);},_f=function(t,e){for(var i=[t];i.length>0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,w(n.children));}},Rf=Phaser.Utils.Array,Lf={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e<i;e++)t.push(this.children[e]);else t=this.children;return t},getAllChildren:function(t){void 0===t&&(t=[]);var e=this;return _f(e,(function(i){i!==e&&t.push(i);})),t},getAllVisibleChildren:function(t){void 0===t&&(t=[]);var e=this;return _f(e,(function(i){if(i!==e)return !i.visible||void t.push(i)})),t},bfs:function(t,e){return void 0===e&&(e=this),_f(e,t),this},dfs:function(t,e){return void 0===e&&(e=this),Ef(e,t),this},contains:function(t){var e=$d(t);return !!e&&(e===this||this.contains(e))},getByName:function(t,e){if(e){for(var i,n,s=[this];s.length;)for(var r=0,o=(i=s.shift()).children.length;r<o;r++){if((n=i.children[r]).name===t)return n;n.isRexContainerLite&&s.push(n);}return null}return Rf.GetFirst(this.children,"name",t)},getRandom:function(t,e){return Rf.GetRandom(this.children,t,e)},getFirst:function(t,e,i,n){return Rf.GetFirstElement(this.children,t,e,i,n)},getAll:function(t,e,i,n){return Rf.GetAll(this.children,t,e,i,n)},count:function(t,e,i,n){return Rf.CountAllMatching(this.children,t,e,i,n)},swap:function(t,e){return Rf.Swap(this.children,t,e),this},setAll:function(t,e,i,n){return Rf.SetAll(this.children,t,e,i,n),this}},Bf=function(t){for(var e=[],i=0,n=t.length;i<n;i++){var s=t[i];s.hasOwnProperty("rexContainer")&&e.push(s.rexContainer);}return e},Df=function(t,e,i){if(i.parent){var n=i.parent,s=i.self;switch(e){case"x":case"y":n.updateChildPosition(s);break;case"angle":case"rotation":n.updateChildRotation(s);break;case"scaleX":case"scaleY":case"displayWidth":case"displayHeight":n.updateChildScale(s);break;case"alpha":n.updateChildAlpha(s);break;default:n.updateChildPosition(s),n.updateChildRotation(s),n.updateChildScale(s),n.updateChildAlpha(s);}}else t.remove();},If={tweenChild:function(t){var e=t.targets;Array.isArray(e)||(e=[e]);var i=this.scene||function(t){for(var e=0,i=t.length;e<i;e++){var n=t[e].scene;if(n)return n}return null}(e);if(i){t.targets=Bf(e);var n=i.tweens.add(t);return n.on("update",Df),n}},tweenSelf:function(t){return t.targets=[this],this.tweenChild(t)},createTweenChildConfig:function(t){var e=t.targets;e&&(Array.isArray(e)||(e=[e]),t.targets=Bf(e));var i=t.onUpdate;return t.onUpdate=function(t,e){i&&i(t,e),Df(t,void 0,e);},t},tween:function(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}},jf=Phaser.GameObjects.Container,zf=Phaser.GameObjects.Layer,Af=function(t){return t instanceof zf},Ff=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return !!t.displayList||!!t.parentContainer}))},Wf=function(t){var e=Ff(this);co(e),t.add(e);},Vf=function(t,e,i){if(this.scene){var n=Ff(this);co(n,e),t.remove(n),i&&n.forEach((function(t){t.addToDisplayList();}));}},Yf={addToContainer:function(t){return function(t){return t instanceof jf}(t)?(this._setParentContainerFlag=!0,Wf.call(this,t),this._setParentContainerFlag=!1,this):this},addToLayer:function(t){return Af(t)?(Wf.call(this,t),this):this},removeFromContainer:function(){return this.parentContainer?(this._setParentContainerFlag=!0,Vf.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer:function(t){return void 0===t&&(t=!0),Af(this.displayList)?(Vf.call(this,this.displayList,!1,t),this):this},getParentContainer:function(){if(this.parentContainer)return this.parentContainer;for(var t=this.getParent();t;){var e=t.parentContainer;if(e)return e;t=t.getParent();}return null},addToParentContainer:function(t){if(!t.displayList)return this;var e=this.getParentContainer();return e?(t.isRexContainerLite?t.addToContainer(e):e.add(t),this):this}},Gf={hasLayer:function(){return !!this.privateRenderLayer},enableLayer:function(){if(this.hasLayer())return this;var t=this.scene.add.layer();return this.moveDepthBelow(t),this.addToLayer(t),this.privateRenderLayer=t,this},getLayer:function(){return this.hasLayer()||this.enableLayer(),this.privateRenderLayer},getRenderLayer:function(){if(this.hasLayer())return this.privateRenderLayer;for(var t=this.getParent();t;){var e=t.privateRenderLayer;if(e)return e;t=t.getParent();}return null},addToRenderLayer:function(t){if(!t.displayList)return this;var e=this.getRenderLayer();return e?(t.isRexContainerLite?t.addToLayer(e):e.add(t),nf(t).layer=e,this):this},removeFromRenderLayer:function(t){var e=nf(t),i=e.layer;return i?(t.isRexContainerLite?t.removeFromLayer(!0):i.remove(t),e.layer=null,this):this}},Xf=Phaser.Geom.Rectangle,Hf=Phaser.Geom.Rectangle.Union,Uf=Phaser.GameObjects.GameObject,Nf=function(t){return t instanceof Uf},Kf=Phaser.Utils.Objects.GetValue,Jf=Phaser.Textures.DynamicTexture,qf=Phaser.Utils.String.UUID,Zf=function(t){if(t){var e,i,n=t.gameObjects,s=t.renderTexture,r=Kf(t,"x",void 0),o=Kf(t,"y",void 0),a=Kf(t,"width",void 0),h=Kf(t,"height",void 0),l=Kf(t,"originX",0),u=Kf(t,"originY",0),c=Kf(t,"padding",0);if(void 0===a||void 0===h||void 0===r||void 0===o){var d=function(t,e){var i;void 0===e?e=new Xf:!0===e&&(void 0===Zd&&(Zd=new Xf),e=Zd),e.setTo(0,0,0,0);for(var n=!0,s=0,r=t.length;s<r;s++)if((i=t[s]).getBounds){var o=Ur(i,!0);n?(e.setTo(o.x,o.y,o.width,o.height),n=!1):Hf(o,e,e);}return e}(n,!0);void 0!==r&&void 0!==o?(a=2*Math.max(r-d.left,d.right-r),h=2*Math.max(o-d.top,d.bottom-o),l=.5,u=.5):(r=d.x,o=d.y,a=d.width,h=d.height,l=0,u=0),e=d.x,i=d.y;}else e=r+(0-l)*a,i=o+(0-u)*h;e-=c,i-=c,a+=2*c,h+=2*c;var f=n[0].scene;p&&!s&&(s=new Jf(f.sys.textures,qf(),a,h)),s||(s=f.add.renderTexture(0,0,a,h)),s.setPosition&&s.setPosition(r,o),s.width===a&&s.height===h||s.setSize(a,h),s.setOrigin&&s.setOrigin(l,u),s.camera.setScroll(e,i),n=co(ni(n)),s.draw(n);var p=t.saveTexture;if(p)if(Nf(s))s.saveTexture(p);else {var v=s,g=v.manager;g.exists(v.key)?g.renameTexture(v.key,key):(v.key=key,g.list[key]=v,g.emit("addtexture",key,v),g.emit("addtexture-".concat(key),v));}return s}},$f={snapshot:function(t){var e=this.scaleX,i=this.scaleY,n=1===e&&1===i;n||this.setScale(1),void 0===t&&(t={}),t.gameObjects=this.getAllVisibleChildren(),t.x=this.x,t.y=this.y,t.originX=this.originX,t.originY=this.originY;var s=Zf(t),r=!!s.scene;return n||(this.setScale(e,i),r&&s.setScale(e,i)),r?s:this}},Qf=Phaser.Utils.Objects.GetValue,tp=Phaser.Math.RotateAround,ep={changeOrigin:function(t,e){this.syncChildrenEnable=!1,function(t,e,i){void 0===i&&(i=e);var n={x:(e-t.originX)*t.displayWidth,y:(i-t.originY)*t.displayHeight};tp(n,0,0,t.rotation),t.originX=e,t.originY=i,t.x=t.x+n.x,t.y=t.y+n.y;}(this,t,e),this.syncChildrenEnable=!0;for(var i=this.getAllChildren(),n=0,s=i.length;n<s;n++)this.resetChildPositionState(i[n]);return this},drawBounds:function(t,e){var i=Qf(e,"drawContainer",!0),n=Qf(e,"children");return void 0===n&&(n=this.getAllVisibleChildren([this])),i||(n=n.filter((function(t){return !t.isRexContainerLite}))),eo(n,t,e),this}};Object.assign(ep,sf,uf,ff,pf,gf,mf,bf,xf,Cf,wf,Sf,Pf,Tf,Mf,Lf,If,Yf,Gf,$f);var ip=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),Array.isArray(r)&&(a=r,r=void 0,o=void 0),(l=t(this,i,[e,n,s,r,o])).type="rexContainerLite",l.isRexContainerLite=!0,l.syncChildrenEnable=!0,l._active=!0,l._mask=null,l._scrollFactorX=1,l._scrollFactorY=1,l.privateRenderLayer=void 0,a&&l.add(a),l}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.syncChildrenEnable=!1,m(f(i.prototype),"destroy",this).call(this,t),this.privateRenderLayer&&(this.privateRenderLayer.list.length=0,this.privateRenderLayer.destroy()));}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"x",get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.syncPosition());}},{key:"y",get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.syncPosition());}},{key:"rotation",get:function(){return m(f(i.prototype),"rotation",this)},set:function(t){this.rotation!==t&&(b(f(i.prototype),"rotation",t,this,!0),this.syncPosition());}},{key:"scaleX",get:function(){return m(f(i.prototype),"scaleX",this)},set:function(t){this.scaleX!==t&&(b(f(i.prototype),"scaleX",t,this,!0),this.syncPosition());}},{key:"scaleY",get:function(){return m(f(i.prototype),"scaleY",this)},set:function(t){this.scaleY!==t&&(b(f(i.prototype),"scaleY",t,this,!0),this.syncPosition());}},{key:"scale",get:function(){return m(f(i.prototype),"scale",this)},set:function(t){this.scale!==t&&(b(f(i.prototype),"scale",t,this,!0),this.syncPosition());}},{key:"visible",get:function(){return m(f(i.prototype),"visible",this)},set:function(t){m(f(i.prototype),"visible",this)!==t&&(b(f(i.prototype),"visible",t,this,!0),this.syncVisible());}},{key:"alpha",get:function(){return m(f(i.prototype),"alpha",this)},set:function(t){m(f(i.prototype),"alpha",this)!==t&&(b(f(i.prototype),"alpha",t,this,!0),this.syncAlpha());}},{key:"active",get:function(){return this._active},set:function(t){this._active!==t&&(this._active=t,this.syncActive());}},{key:"mask",get:function(){return this._mask},set:function(t){this._mask!==t&&(this._mask=t,this.syncMask());}},{key:"scrollFactorX",get:function(){return this._scrollFactorX},set:function(t){this._scrollFactorX!==t&&(this._scrollFactorX=t,this.syncScrollFactor());}},{key:"scrollFactorY",get:function(){return this._scrollFactorY},set:function(t){this._scrollFactorY!==t&&(this._scrollFactorY=t,this.syncScrollFactor());}},{key:"list",get:function(){return this.children}},{key:"parentContainer",get:function(){return this._parentContainer},set:function(t){this._parentContainer||t?this.setParentContainerFlag?this._parentContainer=t:this._parentContainer&&!t?(this.removeFromContainer(),this._parentContainer=t):t?(this._parentContainer=t,this.addToContainer(t)):this._parentContainer=t:this._parentContainer=t;}},{key:"setParentContainerFlag",get:function(){if(this._setParentContainerFlag)return !0;var t=$d(this);return !!t&&t.setParentContainerFlag}}],[{key:"GetParent",value:function(t){return $d(t)}}]),i}(Jd);Object.assign(ip.prototype,ep);var np=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};var sp=Phaser.Display.Align,rp={center:sp.CENTER,left:sp.LEFT_CENTER,right:sp.RIGHT_CENTER,top:sp.TOP_CENTER,bottom:sp.BOTTOM_CENTER,"left-top":sp.TOP_LEFT,"top-left":sp.TOP_LEFT,"left-center":sp.LEFT_CENTER,"center-left":sp.LEFT_CENTER,"left-bottom":sp.BOTTOM_LEFT,"bottom-left":sp.BOTTOM_LEFT,"center-top":sp.TOP_CENTER,"top-center":sp.TOP_CENTER,"center-center":sp.CENTER,"center-bottom":sp.BOTTOM_CENTER,"bottom-center":sp.BOTTOM_CENTER,"right-top":sp.TOP_RIGHT,"top-right":sp.TOP_RIGHT,"right-center":sp.RIGHT_CENTER,"center-right":sp.RIGHT_CENTER,"right-bottom":sp.BOTTOM_RIGHT,"bottom-right":sp.BOTTOM_RIGHT},op=new Phaser.GameObjects.Zone({sys:{queueDepthSort:z,events:{once:z}}},0,0,1,1);op.setOrigin(0);var ap=0,hp=1,lp=2,up=4,cp=6,dp=8,fp=10,pp=12,vp=function(t){var e=Yr(t);return t.y+e-e*t.originY},gp=function(t){var e=Vr(t);return t.x-e*t.originX+.5*e},yp=function(t,e){var i=Yr(t);return t.y=e-i+i*t.originY,t},mp=function(t,e){var i=Vr(t),n=i*t.originX;return t.x=e+n-.5*i,t},kp=function(t){var e=Vr(t);return t.x-e*t.originX},bp=function(t,e){var i=Vr(t);return t.x=e+i*t.originX,t},xp=function(t){var e=Vr(t);return t.x+e-e*t.originX},Cp=function(t,e){var i=Vr(t);return t.x=e-i+i*t.originX,t},wp=function(t,e){var i=Yr(t),n=i*t.originY;return t.y=e+n-.5*i,t},Sp=function(t){var e=Yr(t);return t.y-e*t.originY+.5*e},Pp=function(t){var e=Yr(t);return t.y-e*t.originY},Tp=function(t,e){var i=Yr(t);return t.y=e+i*t.originY,t},Op=[];Op[11]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),mp(t,gp(e)+i),yp(t,vp(e)+n),t},Op[fp]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),bp(t,kp(e)-i),yp(t,vp(e)+n),t},Op[pp]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),Cp(t,xp(e)+i),yp(t,vp(e)+n),t},Op[cp]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),function(t,e,i){mp(t,e),wp(t,i);}(t,gp(e)+i,Sp(e)+n),t},Op[up]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),bp(t,kp(e)-i),wp(t,Sp(e)+n),t},Op[dp]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),Cp(t,xp(e)+i),wp(t,Sp(e)+n),t},Op[hp]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),mp(t,gp(e)+i),Tp(t,Pp(e)-n),t},Op[ap]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),bp(t,kp(e)-i),Tp(t,Pp(e)-n),t},Op[lp]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),Cp(t,xp(e)+i),Tp(t,Pp(e)-n),t};var Mp=function(t,e,i,n,s){return Op[i](t,e,n,s)},Ep=function(t,e,i,n,s,r){op.setPosition(e,i).setSize(n,s),Mp(t,op,r);},_p=Phaser.Utils.Objects.GetValue,Rp=Phaser.GameObjects.Group,Lp=function(t,e,i){return t.add.text(0,0,"")},Bp=void 0,Dp=Phaser.Utils.Objects.GetValue,Ip=function(t,e){return void 0===t&&(t=0),void 0===e&&(e={}),"number"==typeof t?(e.left=t,e.right=t,e.top=t,e.bottom=t):(e.left=Dp(t,"left",0),e.right=Dp(t,"right",0),e.top=Dp(t,"top",0),e.bottom=Dp(t,"bottom",0)),e},jp=ip.prototype.add,zp=function(t){return jp.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},Ap={addBackground:function(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),zp.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=Ip(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground:function(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Fp=function t(e,i){var n=null;if(void 0===i)e.hasOwnProperty("rexContainer")&&((n=e.rexContainer.parent)?n.isRexSizer||(n=t(n)):n=null);else for(n=t(e);n&&n.name!==i;)n=t(n);return n},Wp={getParentSizer:function(t,e){return "string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),Fp(t,e)},getTopmostSizer:function(t){return void 0===t&&(t=this),function(t){for(var e=Fp(t);e;)t=e,e=Fp(e);return t}(t)},hasParentSizer:function(t,e){void 0===e&&(e=this);for(var i=Fp(e);i;){if(i===t)return !0;i=Fp(i);}return !1},hasChild:function(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}},Vp=Phaser.Utils.Array.Remove,Yp=ip.prototype.remove,Gp=Wp.getParentSizer,Xp=function(t,e){for(var i=Gp(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=Gp(i);return this.isBackground(t)&&Vp(this.backgroundChildren,t),Yp.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this},Hp=Phaser.Utils.Array.Remove,Up=Wp.getParentSizer,Np={removeFromParentSizer:function(){var t=Up(gameObject);return t&&t.remove(this),this},removeBackground:function(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(Hp(this.backgroundChildren,t),Xp.call(this,t,e)),this},removeAllBackgrounds:function(t){if(void 0===this.backgroundChildren)return this;for(var e=this.backgroundChildren.length-1;e>=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Kp=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else {var i=t;for(t in i)this.childrenMap[t]=i[t];}return this},Jp=/(\S+)\[(\d+)\]/i,qp={getInnerPadding:function(t){return An(this.space,t)},setInnerPadding:function(t,e){return Fn(this.space,t,e),this},getOuterPadding:function(t){return An(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Fn(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),An(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Fn(this.getSizerConfig(t).padding,e,i),this}},Zp=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t}},$p=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return !0;return !1},Qp=function(t){var e,i,n;for(var s in this.sizerChildren)!(e=this.sizerChildren[s])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(n=e.resolveWidth(i))&&(n=i):n=i,e.runWidthWrap(n));return this},tv=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t}},ev=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return !0;return !1},iv=function(t){var e,i,n;for(var s in this.sizerChildren)!(e=this.sizerChildren[s])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(n=e.resolveHeight(i))&&(n=i):n=i,e.runHeightWrap(n));return this},nv={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,s=i.length;n<s;n++)(e=i[n]).rexSizer&&e.rexSizer.hidden||t.push(e);return t},getAllShownChildren:function(t){void 0===t&&(t=[]);for(var e=[this];e.length>0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,w(i.children)));}return t}},sv=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i<n;i++)(t=e[i]).ignoreLayout||t.preLayout();},rv=function(t,e,i,n,s){var r=ov(t,e,n),o=av(t,i,s);return void 0===r&&(r=ov(t,e,n)),void 0!==r&&void 0!==o&&{width:r,height:o}},ov=function(t,e,i){return void 0!==(e=t.resolveWidth(e))&&i&&(t.resolveChildrenWidth(e),t.runWidthWrap(e)),e},av=function(t,e,i){return void 0!==(e=t.resolveHeight(e))&&i&&(t.resolveChildrenHeight(e),t.runHeightWrap(e)),e},hv=[Phaser.GameObjects.Image,Phaser.GameObjects.Sprite,Phaser.GameObjects.Mesh,Phaser.GameObjects.Shader,Phaser.GameObjects.Video],lv=[Phaser.GameObjects.BitmapText],uv=function(t,e,i){if(t&&(void 0!==e||void 0!==i))if(function(t){if(t.resize)return !0;if(!t.setSize)return !1;for(var e=0,i=hv.length;e<i;e++){var n=hv[e];if(n&&t instanceof n)return !1}return !0}(t))void 0===e&&(e=t.width),void 0===i&&(i=t.height),t.resize?t.resize(e,i):t.setSize(e,i);else {var n=function(t){if(void 0===t.displayWidth)return !1;for(var e=0,i=lv.length;e<i;e++){var n=lv[e];if(n&&t instanceof n)return !1}return !0}(t);void 0!==e&&(n?t.displayWidth=e:t.scaleX=e/t.width),void 0!==i&&(n?t.displayHeight=i:t.scaleY=i/t.height);}},cv=function(t,e,i,n){uv(i,t,e);},dv=Phaser.Utils.Objects.GetValue,fv=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,{eventEmitter:!1}])).viewport=void 0,s.resetFromJSON(n),s}return d(i,e),u(i,[{key:"shutdown",value:function(t){this.isShutdown||(this.autoAnchor(!1),this.viewport=void 0,this.onUpdateViewportCallback=void 0,this.onUpdateViewportCallbackScope=void 0,this.onResizeCallback=void 0,this.onResizeCallbackScope=void 0,m(f(i.prototype),"shutdown",this).call(this,t));}},{key:"resetFromJSON",value:function(t){var e,i,n,s,r,o,a,h;void 0===t&&(t={}),void 0!==t.x?(e=null,i=t.x):void 0!==t.left?(e=0,i=t.left):void 0!==t.right?(e=1,i=t.right):void 0!==t.centerX&&(e=.5,i=t.centerX),void 0!==t.y?(n=null,s=t.y):void 0!==t.top?(n=0,s=t.top):void 0!==t.bottom?(n=1,s=t.bottom):void 0!==t.centerY&&(n=.5,s=t.centerY),void 0!==i&&(i=i.replace("left","0%").replace("right","100%").replace("center","50%").split("%"),r=parseFloat(i[0])/100,o=""===i[1]?0:parseFloat(i[1])),void 0!==s&&(s=s.replace("top","0%").replace("bottom","100%").replace("center","50%").split("%"),a=parseFloat(s[0])/100,h=""===s[1]?0:parseFloat(s[1]));var l,u,c=t.width;void 0!==c&&(c=c.split("%"),l=parseFloat(c[0])/100,u=""===c[1]?0:parseFloat(c[1]));var d,f,p=t.height;void 0!==p&&(p=p.split("%"),d=parseFloat(p[0])/100,f=""===p[1]?0:parseFloat(p[1])),this.setAlign(e,n),this.setPercentage(r,a),this.setOffset(o,h),this.setSizePercentage(l,d),this.setSizePadding(u,f);var v=dv(t,"onResizeCallback",cv),g=dv(t,"onResizeCallbackScope");this.setResizeCallback(v,g);var y=dv(t,"onUpdateViewportCallback"),m=dv(t,"onUpdateViewportCallbackScope");return this.setUpdateViewportCallback(y,m),this.autoAnchor(t.enable),this}},{key:"autoAnchor",value:function(t){return void 0===t&&(t=!0),t=!!t,this.autoAnchorEnable===t||(t?(this.scene.sys.scale.on("resize",this.anchor,this),this.anchor()):this.scene.sys.scale.off("resize",this.anchor,this),this.autoAnchorEnable=t),this}},{key:"setAlign",value:function(t,e){return this.alignX=t,this.alignY=e,this}},{key:"setPercentage",value:function(t,e){return this.percentageX=t,this.percentageY=e,this}},{key:"setOffset",value:function(t,e){return this.offsetX=t,this.offsetY=e,this}},{key:"setSizePercentage",value:function(t,e){return this.percentageWidth=t,this.percentageHeight=e,this}},{key:"setSizePadding",value:function(t,e){return this.paddingWidth=t,this.paddingHeight=e,this}},{key:"setResizeCallback",value:function(t,e){return this.onResizeCallback=t,this.onResizeCallbackScope=e,this}},{key:"setUpdateViewportCallback",value:function(t,e){return this.onUpdateViewportCallback=t,this.onUpdateViewportCallbackScope=e,this}},{key:"anchor",value:function(){return this.updateViewport(),this.updateSize(),this.updatePosition(),this}},{key:"updateSize",value:function(){var t=this.onResizeCallback,e=this.onResizeCallbackScope,i=this.anchorWidth,n=this.anchorHeight;if((void 0!==i||void 0!==n)&&t){var s=this.parent;void 0===i&&(i=s.width),void 0===n&&(n=s.height),e?t.call(e,i,n,s,this):t(i,n,s,this);}}},{key:"updatePosition",value:function(){var t=this.parent;return null===this.alignX?t.x=this.anchorX:void 0!==this.alignX&&(t.x=this.anchorX+t.displayWidth*(t.originX-this.alignX)),null===this.alignY?t.y=this.anchorY:void 0!==this.alignY&&(t.y=this.anchorY+t.displayHeight*(t.originY-this.alignY)),this}},{key:"anchorX",get:function(){return this.viewport.x+this.viewport.width*this.percentageX+this.offsetX}},{key:"anchorY",get:function(){return this.viewport.y+this.viewport.height*this.percentageY+this.offsetY}},{key:"anchorWidth",get:function(){if(void 0!==this.percentageWidth)return this.viewport.width*this.percentageWidth+this.paddingWidth}},{key:"anchorHeight",get:function(){if(void 0!==this.percentageHeight)return this.viewport.height*this.percentageHeight+this.paddingHeight}},{key:"updateViewport",value:function(){var t=this.parent.scene.cameras.main;this.viewport=ao(this.scene,t,this.viewport);var e=this.viewport,i=this.onUpdateViewportCallback,n=this.onUpdateViewportCallbackScope;i&&(n?i.call(n,e,this.parent,this):i(e,this.parent,this));}}]),i}(mo),pv=Phaser.Utils.Objects.GetValue,vv=Phaser.Utils.Objects.GetAdvancedValue,gv=Phaser.Math.Linear,yv=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).scaleStart={},s.scaleEnd={},s.resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return m(f(i.prototype),"resetFromJSON",this).call(this,t),this.setMode(pv(t,"mode",0)),this.setScaleRange(vv(t,"start",void 0),vv(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=mv[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return "number"==typeof t?(this.startX=t,this.startY=t):(this.startX=vv(t,"x",this.parent.scaleX),this.startY=vv(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=vv(e,"x",void 0),this.endY=vv(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),m(f(i.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=gv(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=gv(this.startY,this.endY,i));}},{key:"complete",value:function(){return m(f(i.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),i}(zo),mv={stop:0,destroy:1,yoyo:2},kv=function(t,e,i,n,s){var r,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":r={x:0},o={x:t.scaleX};break;case 1:case"y":r={y:0},o={y:t.scaleY};break;default:r=0,o=t.scale;}var a={mode:0,start:r,end:o,duration:e,ease:n};return void 0===s?s=new yv(t,a):s.resetFromJSON(a),s.restart(),s},bv=function(t,e,i,n,s,r){void 0===n&&(n="Linear"),s instanceof yv&&(r=s,s=void 0),void 0===s&&(s=!0);var o={};switch(o.mode=s?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===r?r=new yv(t,o):r.resetFromJSON(o),r.restart(),r},xv=Phaser.Utils.Objects.IsPlainObject,Cv=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Wp.getParentSizer(t);e&&e.resetChildPositionState(t);}));},wv={popUp:function(t,e,i){if(xv(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=kv(this,t,e,i,this._scaleBehavior),s&&Cv(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),jh(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(xv(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease,n=s.destroy;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=bv(this,t,e,i,n,this._scaleBehavior),r&&Cv(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),jh(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),jh(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,s){if(xv(t)){var r=t;t=r.duration,e=r.peakValue,i=r.repeat,n=r.orientation,s=r.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,s,r,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===r&&(r="Cubic"),s){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var l={mode:2,start:a,end:h,duration:e/2,ease:r,repeat:n};return void 0===o?o=new yv(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,n,s,this._scaleBehavior),o&&Cv(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,s){return this.scaleYoyo(t,e,i,n,s),jh(this._scaleBehavior)}},Sv=Phaser.Utils.Objects.GetValue,Pv=Phaser.Utils.Objects.GetAdvancedValue,Tv=Phaser.Math.Linear,Ov=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return m(f(i.prototype),"resetFromJSON",this).call(this,t),this.setMode(Sv(t,"mode",0)),this.setAlphaRange(Pv(t,"start",this.parent.alpha),Pv(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Mv[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),m(f(i.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Tv(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return m(f(i.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),i}(zo),Mv={stop:0,destroy:1,yoyo:2},Ev=Phaser.Utils.Objects.IsPlainObject,_v=function(t,e,i,n){var s,r;Ev(i)?(s=i.start,r=i.end):r=i,void 0===s&&(s=0),void 0===r&&(r=1);var o={mode:0,start:s,end:r,duration:e};return void 0===n?n=new Ov(t,o):n.resetFromJSON(o),n.restart(),n},Rv=function(t,e,i,n){i instanceof Ov&&(n=i,i=void 0),void 0===i&&(i=!0);var s={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Ov(t,s):n.resetFromJSON(s),n.restart(),n},Lv=Phaser.Utils.Objects.IsPlainObject,Bv=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Wp.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Dv={fadeIn:function(t,e){if(Lv(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=_v(this,t,e,this._fade),n&&Bv(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),jh(this._fade)},fadeOutDestroy:function(t,e){if(Lv(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Rv(this,t,e,this._fade),n&&Bv(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),jh(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),jh(this._fade)}},Iv=Phaser.Utils.Objects.GetValue,jv=Phaser.Utils.Objects.GetAdvancedValue,zv=Phaser.Math.Linear,Av=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){if(m(f(i.prototype),"resetFromJSON",this).call(this,t),this.setMode(Iv(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=jv(t,"x",void 0),n=jv(t,"y",void 0);this.setTargetPosition(e,n);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Fv[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else {var i=t;this.startX=jv(i,"startX",void 0),this.startY=jv(i,"startY",void 0),this.endX=jv(i,"endX",void 0),this.endY=jv(i,"endY",void 0);}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),m(f(i.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=zv(this.startX,this.endX,i)),this.hasMoveY&&(t.y=zv(this.startY,this.endY,i));}},{key:"complete",value:function(){return m(f(i.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),i}(zo),Fv={stop:0,destroy:1,yoyo:2},Wv=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},Vv=function(t,e,i,n,s,r,o){r instanceof Av&&(o=r,r=void 0),void 0===r&&(r=!1);var a={};return a.mode=r?1:0,void 0!==i&&(a.startX=t.x,a.endX=Wv(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=Wv(n,t.y)),a.duration=e,a.ease=void 0===s?"Linear":s,void 0===o?o=new Av(t,a):o.resetFromJSON(a),o.restart(),o},Yv=function(t,e,i,n,s,r,o){r instanceof Av&&(o=r,r=void 0),void 0===r&&(r=!1);var a={};return a.mode=r?1:0,void 0!==i&&(a.startX=Wv(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=Wv(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===s?"Linear":s,void 0===o?o=new Av(t,a):o.resetFromJSON(a),o.restart(),o},Gv=Phaser.Utils.Objects.IsPlainObject,Xv=Phaser.Math.Distance.Between,Hv=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Wp.getParentSizer(t);e&&e.resetChildPositionState(t);}));},Uv={moveFrom:function(t,e,i,n,s){if(Gv(t)){var r=t;e=r.x,i=r.y,t=r.hasOwnProperty("speed")?1e3*Xv(e,i,this.x,this.y)/r.speed:r.duration,n=r.ease;}var o=void 0===this._easeMove;return this._easeMove=Yv(this,t,e,i,n,s,this._easeMove),o&&Hv(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,s){return this.moveFrom(t,e,i,n,s),jh(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),jh(this._easeMove)},moveTo:function(t,e,i,n,s){if(Gv(t)){var r=t;e=r.x,i=r.y,t=r.hasOwnProperty("speed")?1e3*Xv(e,i,this.x,this.y)/r.speed:r.duration,n=r.ease;}var o=void 0===this._easeMove;return this._easeMove=Vv(this,t,e,i,n,s,this._easeMove),o&&Hv(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,s){return this.moveTo(t,e,i,n,s),jh(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),jh(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Nv=Phaser.Utils.Objects.GetValue,Kv=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).timer=new Oo,s.resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Nv(t,"timer")),this.setEnable(Nv(t,"enable",!0)),this.setMode(Nv(t,"mode",1)),this.isRunning=Nv(t,"isRunning",!1),this.setMagnitudeMode(Nv(t,"magnitudeMode",1)),this.setAxisMode(Nv(t,"axis",0)),this.setDuration(Nv(t,"duration",500)),this.setMagnitude(Nv(t,"magnitude",10)),this.ox=Nv(t,"ox",void 0),this.oy=Nv(t,"oy",void 0),this}},{key:"toJSON",value:function(){return {timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}},{key:"shutdown",value:function(t){this.isShutdown||(m(f(i.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){m(f(i.prototype),"startTicking",this).call(this),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this);}},{key:"stopTicking",value:function(){m(f(i.prototype),"stopTicking",this).call(this),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Jv[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=Zv[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=qv[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var n=t;e=Nv(n,"magnitude",void 0),t=Nv(n,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),m(f(i.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else {void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var s=Math.random()*Math.PI*2,r=this.ox+Math.cos(s)*n,o=this.oy+Math.sin(s)*n;switch(this.axisMode){case 1:i.x=r;break;case 2:i.y=o;break;default:i.x=r,i.y=o;}}return this}},{key:"backToOrigin",value:function(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy;}return this.ox=void 0,this.oy=void 0,this}}]),i}(bo),Jv={effect:0,behavior:1},qv={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},Zv={constant:0,decay:1},$v=Phaser.Utils.Objects.IsPlainObject,Qv={shake:function(t,e,i){if($v(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new Kv(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t);}));}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise:function(t,e){return this.shake(t,e),jh(this._shake)}},tg=Phaser.Utils.Objects.IsPlainObject,eg=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).parent.setDataEnabled(),s.easeTasks={},s}return d(i,e),u(i,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new vc(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(tg(t)){var s=t;t=s.key,e=s.value,i=s.duration,n=s.ease;var r=s.speed;void 0===i&&void 0!==r&&(i=Math.abs(e-this.parent.data.values[t])/r*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(tg(t)){var s=t;t=s.key,e=s.value,i=s.duration,n=s.ease;var r=s.speed;void 0===i&&void 0!==r&&(i=Math.abs(e-this.parent.data.values[t])/r*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),i}(mo),ig={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new eg(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),Ih(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ng=function(t){og(t,!1);},sg=function(t){og(t,!0);},rg=function(t){return !!t&&!np(t).hidden},og=function(t,e){if(t){np(t).hidden=e;var i=$d(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},ag={show:function(t){return void 0===t&&(t=this),ng(t),this},hide:function(t){return void 0===t&&(t=this),sg(t),this},isShow:function(t){return void 0===t&&(t=this),rg(t)}};function hg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var lg={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function r(t,e,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new s(n,r||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var s=0,r=n.length,o=new Array(r);s<r;s++)o[s]=n[s].fn;return o},a.prototype.listenerCount=function(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,s,r,o){var a=i?i+t:t;if(!this._events[a])return !1;var h,l,u=this._events[a],c=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),c){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,n),!0;case 4:return u.fn.call(u.context,e,n,s),!0;case 5:return u.fn.call(u.context,e,n,s,r),!0;case 6:return u.fn.call(u.context,e,n,s,r,o),!0}for(l=1,h=new Array(c-1);l<c;l++)h[l-1]=arguments[l];u.fn.apply(u.context,h);}else {var d,f=u.length;for(l=0;l<f;l++)switch(u[l].once&&this.removeListener(t,u[l].fn,void 0,!0),c){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,e);break;case 3:u[l].fn.call(u[l].context,e,n);break;case 4:u[l].fn.call(u[l].context,e,n,s);break;default:if(!h)for(d=1,h=new Array(c-1);d<c;d++)h[d-1]=arguments[d];u[l].fn.apply(u[l].context,h);}}return !0},a.prototype.on=function(t,e,i){return r(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return r(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,n,s){var r=i?i+t:t;if(!this._events[r])return this;if(!e)return o(this,r),this;var a=this._events[r];if(a.fn)a.fn!==e||s&&!a.once||n&&a.context!==n||o(this,r);else {for(var h=0,l=[],u=a.length;h<u;h++)(a[h].fn!==e||s&&!a[h].once||n&&a[h].context!==n)&&l.push(a[h]);l.length?this._events[r]=1===l.length?l[0]:l:o(this,r);}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&o(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,t.exports=a;}(lg);var ug=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"shutdown",value:function(){this.removeAllListeners();}},{key:"destroy",value:function(){this.removeAllListeners();}}]),i}(hg(lg.exports)),cg={setEventEmitter:function(t,e){return void 0===e&&(e=ug),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter:function(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter:function(){return this._eventEmitter},on:function(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once:function(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off:function(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit:function(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener:function(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener:function(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners:function(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount:function(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners:function(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames:function(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},dg=["next","exit","enter"],fg=function(){function t(e){h(this,t);var i=wt(e,"states",void 0);i&&this.addStates(i);var n=wt(e,"extend",void 0);if(n)for(var s in n)this.hasOwnProperty(s)&&void 0!==this[s]||(this[s]=n[s]);var r=wt(e,"eventEmitter",void 0),o=wt(e,"EventEmitterClass",void 0);this.setEventEmitter(r,o),this._stateLock=!1,this.resetFromJSON(e);}return u(t,[{key:"shutdown",value:function(){this.destroyEventEmitter();}},{key:"destroy",value:function(){this.shutdown();}},{key:"resetFromJSON",value:function(t){this.setEnable(wt(t,"enable",!0)),this.start(wt(t,"start",void 0));var e=wt(t,"init",void 0);return e&&e.call(this),this}},{key:"toJSON",value:function(){return {curState:this.state,prevState:this.prevState,enable:this.enable,start:this._start}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"state",get:function(){return this._state},set:function(t){if(this.enable&&!this._stateLock&&this._state!==t){if(this._prevState=this._state,this._state=t,this._stateLock=!0,this.emit("statechange",this),null!=this._prevState){var e="exit_"+this._prevState,i=this[e];i&&i.call(this),this.emit(e,this);}if(this._stateLock=!1,null!=this._state){var n="enter_"+this._state,s=this[n];s&&s.call(this),this.emit(n,this);}}}},{key:"prevState",get:function(){return this._prevState}},{key:"start",value:function(t){return this._start=t,this._prevState=void 0,this._state=t,this}},{key:"goto",value:function(t){return null!=t&&(this.state=t),this}},{key:"next",value:function(){var t,e=this["next_"+this.state];return e&&(t="string"==typeof e?e:e.call(this)),this.goto(t),this}},{key:"stateProperties",get:function(){return dg}},{key:"addState",value:function(t,e){"string"!=typeof t&&(t=(e=t).name);for(var i=this.stateProperties,n=0,s=i.length;n<s;n++){var r=i[n],o=e[r];o&&(this["".concat(r,"_").concat(t)]=o);}return this}},{key:"addStates",value:function(t){if(Array.isArray(t))for(var e=0,i=t.length;e<i;e++)this.addState(t[e]);else for(var n in t)this.addState(n,t[n]);return this}},{key:"runMethod",value:function(t,e,i,n,s,r){var o=this[t+"_"+this.state];if(o){var a=arguments.length;switch(a){case 1:return o.call(this);case 2:return o.call(this,e);case 3:return o.call(this,e,i);case 4:return o.call(this,e,i,n);case 5:return o.call(this,e,i,n,s);case 6:return o.call(this,e,i,n,s,r)}for(var h=new Array(a-1),l=1;l<a;l++)h[l-1]=arguments[l];return o.apply(this,h)}}}]),t}();Object.assign(fg.prototype,cg);var pg=function(t,e,i,n,s){void 0===s&&(s=!1);var r=t._events[e];if(!r)return !1;for(var o=0,a=r.length;o<a;o++){var h=r[o];if(h.fn===i&&h.context===n&&h.once===s)return !0}return !1},vg=["next","exit","enter","update","preupdate","postupdate"],gg=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"shutdown",value:function(){this.stopUpdate(),this.stopPreUpdate(),this.stopPostUpdate(),this._scene=void 0,m(f(i.prototype),"shutdown",this).call(this);}},{key:"resetFromJSON",value:function(t){return m(f(i.prototype),"resetFromJSON",this).call(this,t),this._scene=wt(t,"scene",void 0),this}},{key:"stateProperties",get:function(){return vg}},{key:"update",value:function(t,e){this.runMethod("update",t,e);}},{key:"preupdate",value:function(t,e){this.runMethod("preupdate",t,e);}},{key:"postupdate",value:function(t,e){this.runMethod("postupdate",t,e);}},{key:"startUpdate",value:function(t){t||(t=this._scene);var e=t.sys.events;return pg(e,"update",this.update,this)||(this._scene=t,e.on("update",this.update,this)),this}},{key:"stopUpdate",value:function(){return this._scene?(this._scene.sys.events.off("update",this.update,this),this):this}},{key:"startPreUpdate",value:function(t){t||(t=this._scene);var e=t.sys.events;return pg(e,"preupdate",this.preupdate,this)||(this._scene=t,e.on("preupdate",this.preupdate,this)),this}},{key:"stopPreUpdate",value:function(){return this._scene?(this._scene.sys.events.off("preupdate",this.preupdate,this),this):this}},{key:"startPostUpdate",value:function(t){t||(t=this._scene);var e=t.sys.events;return pg(e,"postupdate",this.postupdate,this)||(this._scene=t,e.on("postupdate",this.postupdate,this)),this}},{key:"stopPostUpdate",value:function(){return this._scene?(this._scene.sys.events.off("postupdate",this.postupdate,this),this):this}}]),i}(fg),yg=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[n])).parent=e;var r=n.initState||"IDLE";return s.start(r),s}return d(i,e),u(i,[{key:"init",value:function(){this.start("IDLE");}},{key:"next_IDLE",value:function(){return "TRANS_OPNE"}},{key:"next_TRANS_OPNE",value:function(){return "OPEN"}},{key:"enter_TRANS_OPNE",value:function(){var t=this.parent;if(t.transitInTime>0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),i}(gg),mg={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,s){var r=go(t);return r.time.delayedCall(e,(function(){r.game.events.once("poststep",(function(){i.call(n,s);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},kg={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=z),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=z),this.transitOutCallback=t,this}},bg={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},xg={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Cg={};Object.assign(Cg,mg,kg,bg,xg);var wg=Phaser.Utils.Objects.GetValue,Sg=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).setTransitInTime(wg(n,"duration.in",200)),s.setTransitOutTime(wg(n,"duration.out",200)),s.setTransitInCallback(wg(n,"transitIn")),s.setTransitOutCallback(wg(n,"transitOut")),s.oneShotMode=wg(n,"destroy",!1),s.delayCallTimer=void 0,s._state=new yg(v(s),{eventEmitter:!1,initState:wg(n,"initState","IDLE")}),s.openEventData=void 0,s.closeEventData=void 0,s}return d(i,e),u(i,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),m(f(i.prototype),"shutdown",this).call(this,t));}}]),i}(mo);Object.assign(Sg.prototype,Cg);var Pg=function(e){function i(e,n,s){var r;return h(this,i),(r=t(this,i,[e,0,0,2,2,n,1])).setAlpha(s),r.setScrollFactor(0),r.boot(),r}return d(i,e),u(i,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),m(f(i.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,s=e.height,r=1/i.zoom,o=n/2,a=s/2,h=n*r,l=s*r;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),i}(Phaser.GameObjects.Rectangle),Tg=Phaser.Utils.Objects.GetValue,Og=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,{eventEmitter:!1}])).resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Tg(t,"hitAreaMode",0)),this.setEnable(Tg(t,"enable",!0)),this.setStopMode(Tg(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Mg[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),i}(mo),Mg={default:0,fullWindow:1},Eg=Phaser.Utils.Objects.GetValue,_g=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,Eg(n,"color",0),Eg(n,"alpha",.8)])).touchEventStop=new Og(v(s),{hitAreaMode:1}),s}return d(i,e),u(i)}(Pg),Rg=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,kv(t,e);},Lg=function(t,e){bv(t,e,void 0,void 0,!1);},Bg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,_v(t,e);},Dg=function(t,e){Rv(t,e,!1);},Ig=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,_v(t,e,t.alpha);},jg=function(t,e){Rv(t,e,!1);},zg=function(t,e,i,n,s){return !!t&&(!(n&&!n(t,e,i))&&(!!Ur(t,!0).contains(e,i)&&!(s&&!s(t,e,i))))},Ag=Phaser.Utils.Objects.GetValue,Fg=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=Wg.popUp),null==n.transitOut&&(n.transitOut=Wg.scaleDown),n.destroy=Ag(n,"destroy",!0),s=t(this,i,[e,n]);var r=Ag(n,"cover");s.cover=!1!==r?function(t,e){var i=t.scene,n=new _g(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(e,r):void 0,s.cover&&(s.setCoverTransitInCallback(Ag(r,"transitIn",Ig)),s.setCoverTransitOutCallback(Ag(r,"transitOut",jg)));var o=Ag(n,"touchOutsideClose",!1),a=Ag(n,"duration.hold",-1),l=Ag(n,"timeOutClose",a>=0),u=Ag(n,"anyTouchClose",!1);return Ag(n,"manualClose",!1)&&(o=!1,u=!1,l=!1),u&&(o=!1),l?s.setDisplayTime(a):s.setDisplayTime(-1),u?s.once("open",s.anyTouchClose,v(s)):o&&s.once("open",s.touchOutsideClose,v(s)),Ag(n,"openOnStart",!0)&&s.delayCall(0,s.requestOpen,v(s)),s}return d(i,e),u(i,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),m(f(i.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&zg(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=m(f(i.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=m(f(i.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),m(f(i.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),m(f(i.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=Wg[t]),t){case Wg.popUp:t=Rg;break;case Wg.fadeIn:t=Bg;}return m(f(i.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=Wg[t]),t){case Wg.scaleDown:t=Lg;break;case Wg.fadeOut:t=Dg;}return m(f(i.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),i}(Sg),Wg={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},Vg=function(t,e){var i=new Fg(t,e);return i.on("open",(function(){t.emit("modal.open",i);})),i.on("close",(function(e){t.emit("modal.close",e,i);})),t.on("modal.requestClose",i.requestClose,i),i},Yg=function(t,e){t.emit("modal.requestClose",e);},Gg=function(t){return t&&"function"==typeof t},Xg={modal:function(t,e){return Gg(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=Vg(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return Yg(this,t),this}},Hg=function(t,e,i,n){if(e)return zg(t,e.worldX,e.worldY,i,n);for(var s=t.scene.input.manager,r=s.pointersTotal,o=s.pointers,a=0;a<r;a++)if(e=o[a],zg(t,e.worldX,e.worldY,i,n))return !0;return !1},Ug=function(t){return "[object Array]"===Object.prototype.toString.call(t)},Ng=function(t,e,i,n,s){return zg(t,e,i,Jg(n),qg(s))},Kg=function(t){return !(t.rexSizer&&t.rexSizer.hidden)},Jg=function(t){return t?function(e,i,n){return !!Kg(e)&&(t(e,i,n),!0)}:Kg},qg=function(t){return t},Zg={},$g=function(t){this.sizerEventsEnable&&(!function(t,e){void 0===e?e={}:!0===e&&(e=Zg),e.x=t.x,e.y=t.y,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.width=t.width,e.height=t.height,e.displayWidth=t.displayWidth,e.displayHeight=t.displayHeight;}(t,this.getChildPrevState(t)),this.layoutedChildren.push(t));},Qg=function(t,e,i,n,s,r,o,a){Ep(t,e,i,n,s,r),void 0!==o&&(t.x+=o),void 0!==a&&(t.y+=a),this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this);},ty=Phaser.Display.Align.CENTER,ey=Phaser.Utils.Objects.IsPlainObject,iy={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new wc(t,n)),t._click.on("click",e,i),this):this},offClick:function(t,e,i){return "function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick:function(t,e){return "boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick:function(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},ny=Phaser.Utils.Objects.GetValue,sy=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n]))._enable=void 0;var r=ny(n,"inputConfig",void 0);return r&&e.setInteractive(r),s.resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(ny(t,"enable",!0)),this.setMode(ny(t,"mode",1)),this.setClickInterval(ny(t,"clickInterval",100)),this.setDragThreshold(ny(t,"threshold",void 0)),this}},{key:"boot",value:function(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this);}},{key:"shutdown",value:function(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,m(f(i.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=ry[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?Tl:Hg)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),i}(mo),ry={press:0,pointerdown:0,release:1,pointerup:1},oy={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new sy(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(t,e,i){return "function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside:function(t,e){return "boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside:function(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}},ay=function(e){function i(){var e;return h(this,i),(e=t(this,i,[{eventEmitter:!1}])).goto("IDLE"),e}return d(i,e),u(i,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),i}(gg),hy=Phaser.Utils.Objects.GetValue,ly=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n]))._enable=void 0,s.cooldown=new ay,s.parent.setInteractive(hy(n,"inputConfig",void 0)),s.resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(hy(t,"enable",!0)),this.setCooldown(hy(t,"cooldown",void 0)),this}},{key:"boot",value:function(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,m(f(i.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching;}}]),i}(mo),uy={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Hg(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new ly(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(t,e,i){return "function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new ly(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(t,e,i){return "function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching:function(t,e){return "boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching:function(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},cy=function(t,e,i){for(var n,s=0,r=t.length;s<r;s++)if(n=t[s],Ng(n,e,i))return n.pointToChild(e,i);return null},dy=function(t,e,i,n,s,r,o,a){var h;if(void 0===r)h=s;else if("parent"===n)h=cy(i,s,r);else for(var l=0,u=i.length;l<u;l++){var c=i[l];if(Ng(c,s,r)){h=c;break}}h&&t.emit(e,h,o,a);},fy=Phaser.Utils.Objects.GetValue,py=function(t){var e=fy(t,"down",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointerdown",vy,this));},vy=function(t,e,i,n){var s=this._childrenInteractive;dy(s.eventEmitter,"".concat(s.eventNamePrefix,"down"),s.targetSizers,s.targetMode,t.worldX,t.worldY,t,n);},gy=Phaser.Utils.Objects.GetValue,yy=function(t){var e=gy(t,"up",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointerup",my,this));},my=function(t,e,i,n){var s=this._childrenInteractive;dy(s.eventEmitter,"".concat(s.eventNamePrefix,"up"),s.targetSizers,s.targetMode,t.worldX,t.worldY,t,n);},ky=Phaser.Utils.Objects.GetValue,by=function(t){var e=ky(t,"over",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointermove",xy,this).on("pointerover",xy,this).on("pointerout",Cy,this));},xy=function(t,e,i,n){var s=this._childrenInteractive,r=cy(s.targetSizers,t.worldX,t.worldY),o=s.lastOverChild;r&&o&&r===o||(s.lastOverChild=r,dy(s.eventEmitter,"".concat(s.eventNamePrefix,"out"),s.targetSizers,s.targetMode,o,void 0,t,n),dy(s.eventEmitter,"".concat(s.eventNamePrefix,"over"),s.targetSizers,s.targetMode,r,void 0,t,n));},Cy=function(t,e){var i=this._childrenInteractive,n=i.lastOverChild;i.lastOverChild=null,dy(i.eventEmitter,"".concat(i.eventNamePrefix,"out"),i.targetSizers,i.targetMode,n,void 0,t,e);},wy=Phaser.Utils.Objects.GetValue,Sy=function(t){var e=wy(t,"click",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("threshold")||(e.threshold=10);var i=this._childrenInteractive;this._click=new wc(this,e),this._click.on("click",(function(t,e,n,s){dy(i.eventEmitter,"".concat(i.eventNamePrefix,"click"),i.targetSizers,i.targetMode,n.worldX,n.worldY,n,s);}),this);}},Py=Phaser.Utils.Objects.GetValue,Ty=function(e){function i(e,n){var s;h(this,i);var r=go(e);return r===e&&(e=void 0),(s=t(this,i,[r,n])).gameObject=e,e&&e.setInteractive(Py(n,"inputConfig",void 0)),s._enable=void 0,s.resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.setEnable(Py(t,"enable",!0)),this.setDetectBounds(),void 0===this.gameObject?this.setDetectBounds(Py(t,"bounds",void 0)):this.setDetectBounds(),this.tracerState=Oy,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,this.isTouchingAnyObject=!1,this}},{key:"boot",value:function(){m(f(i.prototype),"boot",this).call(this),this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this);}},{key:"shutdown",value:function(t){this.scene&&(this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.gameObject=void 0,this.bounds=void 0,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,m(f(i.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setDetectBounds",value:function(t){return this.bounds=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(t,e){this.enable&&(void 0===this.pointer&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer!==t&&(this.pointer=t,this.lastPointer=t,this.movedState=!1,this.tracerState=My,void 0===this.gameObject&&(this.isTouchingAnyObject=e.length>0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=Oy,this.onDragEnd()));}},{key:"onPointerMove",value:function(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()));}}},{key:"dragCancel",value:function(){return this.tracerState===My&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Oy,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){m(f(i.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){m(f(i.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Ey,this}}]),i}(bo),Oy=0,My=1,Ey="IDLE",_y=Phaser.Utils.Objects.GetValue,Ry=Phaser.Math.Distance.Between,Ly=function(e){function i(e,n){var s;h(this,i);var r=v(s=t(this,i,[e,n])),o={states:{IDLE:{enter:function(){r.stop(),r.tapsCount=0,r.x=0,r.y=0,r.worldX=0,r.worldY=0;},exit:function(){var t=r.lastPointer;r.x=t.x,r.y=t.y,r.worldX=t.worldX,r.worldY=t.worldY;}},BEGIN:{enter:function(){r.start(),r.tapsCount=0,r.emit("tappingstart",r,r.gameObject,r.lastPointer);}},RECOGNIZED:{enter:function(){r.start(),r.emit("tap",r,r.gameObject,r.lastPointer),r.emit("".concat(r.tapsCount,"tap"),r,r.gameObject,r.lastPointer);}}},init:function(){this.state=By;},eventEmitter:!1};return s.setRecongizedStateObject(new gg(o)),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){m(f(i.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(_y(t,"time",250)),this.setTapInterval(_y(t,"tapInterval",200)),this.setDragThreshold(_y(t,"threshold",9)),this.setTapOffset(_y(t,"tapOffset",10));var e=_y(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(_y(t,"maxTaps",void 0)),this.setMinTaps(_y(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case By:this.state=Dy;break;case Dy:var t=this.lastPointer;Ry(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Iy,this.state=Dy);break;case Iy:this.state=Dy;}}},{key:"onDragEnd",value:function(){this.state===Dy&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Iy));}},{key:"onDrag",value:function(){this.state!==By&&this.pointer.getDistance()>this.dragThreshold&&(this.state=By);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===Dy){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=By);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Iy:this.state=By);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===Iy&&(this.state=By);}},{key:"isTapped",get:function(){return this.state===Iy}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),i}(Ty),By="IDLE",Dy="BEGIN",Iy="RECOGNIZED",jy=Phaser.Utils.Objects.GetValue,zy=function(e){function i(e,n){var s;h(this,i);var r=v(s=t(this,i,[e,n])),o={states:{IDLE:{enter:function(){r.x=0,r.y=0,r.worldX=0,r.worldY=0;},exit:function(){var t=r.lastPointer;r.x=t.x,r.y=t.y,r.worldX=t.worldX,r.worldY=t.worldY;}},BEGIN:{enter:function(){r.start();},exit:function(){r.stop();}},RECOGNIZED:{enter:function(){r.emit("pressstart",r,r.gameObject,r.lastPointer);},exit:function(){r.emit("pressend",r,r.gameObject,r.lastPointer);}}},init:function(){this.state=Ay;},eventEmitter:!1};return s.setRecongizedStateObject(new gg(o)),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return m(f(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(jy(t,"threshold",9)),this.setHoldTime(jy(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=Fy,0===this.holdTime&&(this.state=Wy);}},{key:"onDragEnd",value:function(){this.state=Ay;}},{key:"onDrag",value:function(){this.state!==Ay&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Ay);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===Fy&&t-this.pointer.downTime>=this.holdTime&&(this.state=Wy));}},{key:"isPressed",get:function(){return this.state===Wy}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),i}(Ty),Ay="IDLE",Fy="BEGIN",Wy="RECOGNIZED",Vy=Phaser.Utils.Objects.GetValue,Yy=function(e){function i(e,n){var s;h(this,i);var r=v(s=t(this,i,[e,n])),o={states:{IDLE:{},BEGIN:{enter:function(){var t=r.pointer;r.startX=t.x,r.startY=t.y,r.startWorldX=t.worldX,r.startWorldY=t.worldY;}},RECOGNIZED:{enter:function(){r.emit("panstart",r,r.gameObject,r.lastPointer);},exit:function(){var t=r.lastPointer;r.endX=t.x,r.endY=t.y,r.endWorldX=t.worldX,r.endWorldY=t.worldY,r.emit("panend",r,r.gameObject,r.lastPointer);}}},init:function(){this.state=Gy;},eventEmitter:!1};return s.setRecongizedStateObject(new gg(o)),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return m(f(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Vy(t,"threshold",10)),this}},{key:"onDragStart",value:function(){this.state=Xy,0===this.dragThreshold&&(this.state=Hy);}},{key:"onDragEnd",value:function(){this.state=Gy;}},{key:"onDrag",value:function(){switch(this.state){case Xy:this.pointer.getDistance()>=this.dragThreshold&&(this.state=Hy);break;case Hy:var t=this.pointer.position,e=this.pointer.prevPosition;this.dx=t.x-e.x,this.dy=t.y-e.y;var i=this.pointer;this.x=i.x,this.y=i.y,this.worldX=i.worldX,this.worldY=i.worldY,this.emit("pan",this,this.gameObject,this.lastPointer);}}},{key:"isPanned",get:function(){return this.state===Hy}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),i}(Ty),Gy="IDLE",Xy="BEGIN",Hy="RECOGNIZED",Uy=Phaser.Math.Distance.Between,Ny=Phaser.Math.Angle.Between,Ky={getDt:function(){return yu(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Uy(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Ny(e.x,e.y,t.x,t.y)}},Jy={"up&down":0,"left&right":1,"4dir":2,"8dir":3},qy={},Zy=Phaser.Utils.Objects.GetValue,$y=Phaser.Math.RadToDeg,Qy=function(e){function i(e,n){var s;h(this,i);var r=v(s=t(this,i,[e,n])),o={states:{IDLE:{enter:function(){r.x=0,r.y=0,r.worldX=0,r.worldY=0;},exit:function(){var t=r.lastPointer;r.x=t.x,r.y=t.y,r.worldX=t.worldX,r.worldY=t.worldY;}},BEGIN:{enter:function(){r.validDrag=!1;}},RECOGNIZED:{enter:function(){r.start(),r.updateDirectionStates(),r.emit("swipe",r,r.gameObject,r.lastPointer);},exit:function(){r.stop(),r.clearDirectionStates();}}},init:function(){this.state=tm;},eventEmitter:!1};return s.setRecongizedStateObject(new gg(o)),s.clearDirectionStates(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return m(f(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Zy(t,"threshold",10)),this.setVelocityThreshold(Zy(t,"velocityThreshold",1e3)),this.setDirectionMode(Zy(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=em;}},{key:"onDragEnd",value:function(){this.state=tm;}},{key:"onDrag",value:function(){this.state===em&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=im));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===im&&(this.state=tm);}},{key:"isSwiped",get:function(){return this.state===im}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=Jy[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=qy),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0;}}($y(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),i}(Ty);Object.assign(Qy.prototype,Ky);var tm="IDLE",em="BEGIN",im="RECOGNIZED",nm=Phaser.Utils.Objects.GetValue,sm=Phaser.Utils.Array.SpliceOne,rm=Phaser.Math.Distance.Between,om=Phaser.Math.Angle.Between,am=function(){function t(e,i){h(this,t);var n=go(e);n===e&&(e=void 0);var s=n.input.manager.pointersTotal-1;s<2&&n.input.addPointer(2-s),this.scene=n,this.gameObject=e,e&&e.setInteractive(nm(i,"inputConfig",void 0)),this.setEventEmitter(nm(i,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(i),this.boot();}return u(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(nm(t,"enable",!0)),this.bounds=nm(t,"bounds",void 0),this.tracerState=lm,this.pointers.length=0,St(this.movedState),this}},{key:"boot",value:function(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,St(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.tracerState){case lm:this.tracerState=um,this.onDrag1Start();break;case um:this.tracerState=cm,this.onDrag2Start();}}},{key:"onPointerUp",value:function(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],sm(this.pointers,e),this.tracerState){case um:this.tracerState=lm,this.onDrag1End();break;case cm:this.tracerState=um,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case um:this.onDrag1();break;case cm:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===cm&&this.onDrag2End(),this.pointers.length=0,St(this.movedState),this.tracerState=lm,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==cm)return 0;var t=this.pointers[0],e=this.pointers[1];return rm(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==cm)return 0;var t=this.pointers[0],e=this.pointers[1];return om(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;hm.x=e.x-i.x,hm.y=e.y-i.y;}else hm.x=0,hm.y=0;return hm}},{key:"centerX",get:function(){if(this.tracerState!==cm)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==cm)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==cm)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return (t.x+e.x)/2}},{key:"prevCenterY",get:function(){if(this.tracerState!==cm)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return (t.y+e.y)/2}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=dm,this}}]),t}();Object.assign(am.prototype,vr);var hm={},lm=0,um=1,cm=2,dm="IDLE",fm=Phaser.Utils.Objects.GetValue,pm=function(e){function i(e,n){var s;h(this,i);var r=v(s=t(this,i,[e,n])),o={states:{IDLE:{enter:function(){r.prevDistance=void 0,r.scaleFactor=1;}},BEGIN:{},RECOGNIZED:{enter:function(){r.emit("pinchstart",r);},exit:function(){r.emit("pinchend",r);}}},init:function(){this.state=vm;},eventEmitter:!1};return s.setRecongizedStateObject(new gg(o)),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return m(f(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(fm(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=gm,0===this.dragThreshold&&(this.state=ym);}},{key:"onDrag2End",value:function(){this.state=vm;}},{key:"onDrag2",value:function(){switch(this.state){case gm:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=ym;}break;case ym:t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t;}}},{key:"isPinched",get:function(){return this.state===ym}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),i}(am),vm="IDLE",gm="BEGIN",ym="RECOGNIZED",mm=Phaser.Math.RotateAround,km=function(t,e,i,n){return mm(t,e,i,n),t.rotation+=n,t},bm={},xm=Phaser.Utils.Objects.GetValue,Cm=Phaser.Math.Angle.WrapDegrees,wm=Phaser.Math.Angle.ShortestBetween,Sm=Phaser.Math.RadToDeg,Pm=Phaser.Math.DegToRad,Tm=function(e){function i(e,n){var s;h(this,i);var r=v(s=t(this,i,[e,n])),o={states:{IDLE:{enter:function(){r.prevAngle=void 0,r.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){r.emit("rotatestart",r);},exit:function(){r.emit("rotateend",r);}}},init:function(){this.state=Mm;},eventEmitter:!1};return s.setRecongizedStateObject(new gg(o)),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return m(f(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(xm(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Cm(Sm(this.angleBetween)),this.state=Em,0===this.dragThreshold&&(this.state=_m);}},{key:"onDrag2End",value:function(){this.state=Mm;}},{key:"onDrag2",value:function(){switch(this.state){case Em:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Cm(Sm(this.angleBetween));this.angle=wm(this.prevAngle,t),this.prevAngle=t,this.state=_m;}break;case _m:t=Cm(Sm(this.angleBetween));this.angle=wm(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===_m}},{key:"rotation",get:function(){return Pm(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),i}(am),Om={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,s=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=bm),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),r=s.x,o=s.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l<u;l++)(t=h[l]).x+=i,t.y+=n,km(t,r,o,a);else t.x+=i,t.y+=n,km(t,r,o,a);return this}};Object.assign(Tm.prototype,Om);var Mm="IDLE",Em="BEGIN",_m="RECOGNIZED",Rm=Phaser.Utils.Objects.GetValue,Lm=function(t){var e=Rm(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Ly(this,e),this._tap.on("tap",(function(t,e,n){dy(i.eventEmitter,"".concat(i.eventNamePrefix).concat(t.tapsCount,"tap"),i.targetSizers,i.targetMode,t.worldX,t.worldY,n);}),this);}},Bm=Phaser.Utils.Objects.GetValue,Dm=function(t){var e=Bm(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new zy(this,e),this._press.on("pressstart",(function(t,e,n){dy(i.eventEmitter,"".concat(i.eventNamePrefix,"pressstart"),i.targetSizers,i.targetMode,t.worldX,t.worldY,n);}),this).on("pressend",(function(t,e,n){dy(i.eventEmitter,"".concat(i.eventNamePrefix,"pressend"),i.targetSizers,i.targetMode,t.worldX,t.worldY,n);}),this);}},Im=Phaser.Utils.Objects.GetValue,jm=function(t){var e=Im(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Qy(this,e),this._swipe.on("swipe",(function(t,e,n){var s=t.left?"left":t.right?"right":t.up?"up":"down";dy(i.eventEmitter,"".concat(i.eventNamePrefix,"swipe").concat(s),i.targetSizers,i.targetMode,t.worldX,t.worldY,n);}),this);}},zm=Phaser.Utils.Objects.GetValue,Am=function(t,e){return t.setInteractive(),zm(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:zm(e,"targets",[t]),targetMode:zm(e,"targetMode","parent"),eventEmitter:zm(e,"eventEmitter",t),eventNamePrefix:zm(e,"inputEventPrefix","child.")},py.call(t,e),yy.call(t,e),by.call(t,e),Sy.call(t,e),Lm.call(t,e),Dm.call(t,e),jm.call(t,e),t},Fm={getSizerConfig:function(t){return void 0===t&&(t=this),np(t)},getChildPrevState:function(t){var e=np(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=ao(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,n,s,r,o,a=t.scene;if("number"==typeof e)i=e;else {i=_p(e,"color"),n=_p(e,"lineWidth");var h=_p(e,"name",!1);h&&(s=_p(h,"createTextCallback",Lp),r=_p(h,"createTextCallbackScope",void 0),"string"==typeof(o=_p(h,"align","left-top"))&&(o=rp[o]));}if(void 0===i&&(i=16777215),void 0===n&&(n=1),s&&!t.children){t.children=new Rp(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0;}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0);};}for(var u,c,d=this.getAllShownChildren([this]),f=0,p=d.length;f<p;f++)((u=d[f]).getBounds||void 0!==u.width&&void 0!==u.height)&&(Bp=Ur(u,Bp),null!=i&&t.lineStyle(n,i).strokeRectShape(Bp),u.name&&s&&(c=r?s.call(r,a):s(a))&&(c.setText(u.name),t.children.add(c),Ep(c,Bp.x,Bp.y,Bp.width,Bp.height,o)));return this},resolveWidth:Zp,hasWidthWrap:$p,resolveChildrenWidth:function(t){var e,i,n;for(var s in this.sizerChildren)(e=this.sizerChildren[s])&&e.isRexSizer&&!e.ignoreLayout&&(i=this.getExpandedChildWidth(e,t),void 0===(n=e.resolveWidth(i))&&(n=i),e.resolveChildrenWidth(n));},runWidthWrap:Qp,resolveHeight:tv,hasHeightWrap:ev,resolveChildrenHeight:function(t){var e,i,n;for(var s in this.sizerChildren)(e=this.sizerChildren[s])&&e.isRexSizer&&!e.ignoreLayout&&(i=this.getExpandedChildHeight(e,t),void 0===(n=e.resolveHeight(i))&&(n=i),e.resolveChildrenHeight(n));},runHeightWrap:iv,getChildWidth:function(t){var e;if(t.isRexSizer){var i=t.childrenWidth;if(null==i)return;e=Math.max(t.minWidth,i);}else e=void 0!==t.minWidth?t.minWidth:Vr(t);return e},getChildHeight:function(t){var e;if(t.isRexSizer){var i=t.childrenHeight;if(void 0===i)return;e=Math.max(t.minHeight,i);}else e=void 0!==t.minHeight?t.minHeight:Yr(t);return e},getExpandedChildWidth:function(t,e){return e},getExpandedChildHeight:function(t,e){return e},getChildrenWidth:function(){return 0},getChildrenHeight:function(){return 0},addChildrenMap:Kp,addElement:Kp,removeChildrenMap:function(t){if("object"===o(t)){var e=t;for(var t in this.childrenMap)if(this.childrenMap[t]===e)return delete this.childrenMap[t],this}return delete this.childrenMap[t],this},getElement:function(t,e){if("string"==typeof t&&(t=t.split(".")),0!==t.length){var i=t.shift(),n=null;if("#"===i.charAt(0))i=i.substring(1),n=this.getByName(i,e);else if(-1===i.indexOf("["))this.childrenMap&&(n=this.childrenMap[i]);else {var s=i.match(Jp);if(null!=s&&this.childrenMap){var r=this.childrenMap[s[1]];r&&(n=r[s[2]]);}}return 0===t.length?n:n&&n.childrenMap?n.getElement(t):null}},getChildIndex:function(t){if(Array.isArray(this.sizerChildren)){var e=this.sizerChildren.indexOf(t);return -1===e&&(e=null),e}if(this.getParentSizer(t)!==this)return null;for(var i in this.sizerChildren)if(this.sizerChildre[i]===t)return i;return null},getAllChildrenSizers:function(t){void 0===t&&(t=[]);for(var e=t.length,i=this.getChildrenSizers(t),n=t.length,s=e;s<n;s++)i[s].getAllChildrenSizers(t);return t},getChildrenSizers:function(t){return void 0===t&&(t=[]),t},preLayout:sv,layout:function(){if(this.ignoreLayout)return this;var t=this.scaleX,e=this.scaleY,i=1===t&&1===e;return i||this.setScale(1),this.runLayout(),i||this.setScale(t,e),this},runLayout:function(t,e,i){if(this.ignoreLayout)return this;var n,s,r,o=!t;o&&this.preLayout();var a=o&&this.hasWidthWrap(),h=o&&this.hasHeightWrap();return (n=rv(this,e,i,a,h))||console.error("Can't resolve size of ",this),s=n.width,r=n.height,this.resize(s,r),this.sizerEventsEnable&&void 0===this.layoutedChildren&&(this.layoutedChildren=[]),this.layoutChildren(),this.layoutBackgrounds(),this.sizerEventsEnable&&(this.emit("postlayout",this.layoutedChildren,this),this.layoutedChildren.length=0),this.postLayout(),o&&this._postLayout(),this},layoutChildren:function(){},layoutBackgrounds:function(){if(void 0!==this.backgroundChildren)for(var t,e,i,n,s,r,o,a=this.backgroundChildren,h=this.left,l=this.top,u=this.width,c=this.height,d=0,f=a.length;d<f;d++)(e=(t=a[d]).rexSizer).hidden||(i=e.padding,$g.call(this,t),n=h+i.left,s=l+i.top,r=u-i.left-i.right,o=c-i.top-i.bottom,uv(t,r,o),Qg.call(this,t,n,s,r,o,ty));},postLayout:function(t,e,i){return this},_postLayout:function(t,e,i){return this._anchor&&this._anchor.updatePosition(),this},setAnchor:function(t){void 0===t&&(t={});var e=t.hasOwnProperty("width"),i=t.hasOwnProperty("height"),n=t.hasOwnProperty("onResizeCallback");return !e&&!i||n||(t.onResizeCallback=function(t,n,s){e&&s.setMinWidth(t),i&&s.setMinHeight(n),s.layout();}),void 0===this._anchor?this._anchor=new fv(this,t):this._anchor.resetFromJSON(t),this},isInTouching:function(t,e){return (Nf(t)||"string"==typeof t)&&(e=t,t=void 0),void 0===e?e=this:"string"==typeof e&&(e=this.getElement(e)),Hg(e,t)},pointToChild:function(t,e,i,n,s){if(Gg(i)||(s=i,i=void 0,n=void 0),void 0===s&&(s=this.sizerChildren?this.sizerChildren:this.children),Ug(s)){for(var r,o=0,a=s.length;o<a;o++)if(r=s[o],Ng(r,t,e,i,n))return r}else for(var h in s)if(r=s[h],Ng(r,t,e,i,n))return r;return null},setDraggable:function(t,e,i){if(ey(t)){var n=t;t=n.sensor,i=n.target,e=n.draggable;}else "boolean"!=typeof e&&(i=e,e=void 0);var s=o(t);if("string"===s){var r=t;if(!(t=this.getElement(r)))return console.error("Can get element '".concat(r,"'")),this}else void 0!==t&&"object"==s||(e=t,t=this);return void 0===e&&(e=!0),t.input&&t.input._rexUIDragSizer?t.input.draggable=e:e&&(t.setInteractive(),t.scene.input.setDraggable(t),t.on("drag",(function(e,n,s){var r=void 0===i?this.getTopmostSizer():i;r.x+=n-t.x,r.y+=s-t.y,r.emit("sizer.drag",e,n,s);}),this).on("dragstart",(function(t,e,n){(void 0===i?this.getTopmostSizer():i).emit("sizer.dragstart",t,e,n);}),this).on("dragend",(function(t,e,n,s){(void 0===i?this.getTopmostSizer():i).emit("sizer.dragend",t,e,n,s);}),this).on("drop",(function(t,e){(void 0===i?this.getTopmostSizer():i).emit("sizer.drop",t,e);})),t.input._rexUIDragSizer=!0),this},setChildrenInteractive:function(t){return Am(this,t),this},broadcastEvent:function(){for(var t=this.getAllChildren([this]),e=0,i=t.length;e<i;e++){var n=t[e];n.emit.apply(n,arguments);}return this}};Object.assign(Fm,qp,Ap,Np,Wp,wv,Dv,Uv,Qv,ig,iy,oy,uy,ag,Xg,nv);var Wm=Phaser.Utils.Objects.GetValue,Vm=function(e){function i(e,n,s,r,o,a){var l;h(this,i),(l=t(this,i,[e,n,s,1,1])).isRexSizer=!0,l.setMinSize(r,o),l.setName(Wm(a,"name","")),l.rexSizer={},l.space={},l.backgroundChildren=void 0,l.sizerChildren=void 0,l.childrenMap={},l.layoutedChildren=void 0,l.enableLayoutWarn(!1);var u=Wm(a,"anchor",void 0);u&&l.setAnchor(u),l.setInnerPadding(Wm(a,"space",0));var c=Wm(a,"draggable",!1);return c&&l.setDraggable(c),l.setSizerEventsEnable(Wm(a,"sizerEvents",!1)),l.setDirty(!0),Wm(a,"enableLayer",!1)&&l.enableLayer(),l}return d(i,e),u(i,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e=this.getAllChildrenSizers([this]),n=0,s=e.length;n<s;n++)e[n].sizerEventsEnable=!1;m(f(i.prototype),"destroy",this).call(this,t),St(this.backgroundChildren),St(this.sizerChildren),this.childrenMap=void 0,this.space=void 0,this.rexSizer=void 0,this.layoutedChildren=void 0;}}},{key:"setMinSize",value:function(t,e){return this.setMinWidth(t).setMinHeight(e),this}},{key:"setMinWidth",value:function(t){return null==t&&(t=0),this.minWidth=t,this}},{key:"setMinHeight",value:function(t){return null==t&&(t=0),this.minHeight=t,this}},{key:"setDirty",value:function(t){return void 0===t&&(t=!0),this.dirty=t,this}},{key:"setSizerEventsEnable",value:function(t){return void 0===t&&(t=!0),this.sizerEventsEnable=t,this}},{key:"enableLayoutWarn",value:function(t){return void 0===t&&(t=!0),this.layoutWarnEnable=t,this}},{key:"ignoreLayout",get:function(){return this.rexSizer.hidden||!this.dirty}},{key:"childrenWidth",get:function(){return void 0===this._childrenWidth&&(this._childrenWidth=this.getChildrenWidth()),this._childrenWidth}},{key:"childrenHeight",get:function(){return void 0===this._childrenHeight&&(this._childrenHeight=this.getChildrenHeight()),this._childrenHeight}},{key:"left",get:function(){return this.x-Vr(this)*this.originX},set:function(t){this.x+=t-this.left;}},{key:"alignLeft",value:function(t){return this.left=t,this}},{key:"right",get:function(){return this.left+Vr(this)},set:function(t){this.x+=t-this.right;}},{key:"alignRight",value:function(t){return this.right=t,this}},{key:"centerX",get:function(){return this.left+Vr(this)/2},set:function(t){this.x+=t-this.centerX;}},{key:"alignCenterX",value:function(t){return this.centerX=t,this}},{key:"top",get:function(){return this.y-Yr(this)*this.originY},set:function(t){this.y+=t-this.top;}},{key:"alignTop",value:function(t){return this.top=t,this}},{key:"bottom",get:function(){return this.top+Yr(this)},set:function(t){this.y+=t-this.bottom;}},{key:"alignBottom",value:function(t){return this.bottom=t,this}},{key:"centerY",get:function(){return this.top+Yr(this)/2},set:function(t){this.y+=t-this.centerY;}},{key:"alignCenterY",value:function(t){return this.centerY=t,this}},{key:"innerLeft",get:function(){return this.left+this.space.left*this.scaleX}},{key:"innerRight",get:function(){return this.right-this.space.right*this.scaleX}},{key:"innerTop",get:function(){return this.top+this.space.top*this.scaleY}},{key:"innerBottom",get:function(){return this.bottom-this.space.bottom*this.scaleY}},{key:"innerWidth",get:function(){return (this.width-this.space.left-this.space.right)*this.scaleX}},{key:"innerHeight",get:function(){return (this.height-this.space.top-this.space.bottom)*this.scaleY}},{key:"minInnerWidth",get:function(){var t=(this.minWidth-this.space.left-this.space.right)*this.scaleX;return Math.max(t,0)}},{key:"minInnerHeight",get:function(){var t=(this.minHeight-this.space.top-this.space.bottom)*this.scaleY;return Math.max(t,0)}}]),i}(ip);Object.assign(Vm.prototype,Fm);var Ym=function(t,e,i,n){void 0===i&&(i=!0),void 0===n?n={}:!0===n&&(n=Gm);var s=t.width,r=t.height,o=e.width,a=e.height;if(s<=o&&r<=a)if(i){var h=o/a;h<(l=s/r)?(n.width=o,n.height=o/l):h>l?(n.width=a*l,n.height=a):(n.width=o,n.height=a);}else n.width=s,n.height=r;else {var l=s/r;n.width=Math.min(s,o),n.height=Math.min(r,a);var u=n.width/n.height;u<l?n.height=n.width/l:u>l&&(n.width=n.height*l);}return n},Gm={},Xm=function(t,e){t.layoutWarnEnable&&(t.width<t.childrenWidth&&console.warn("Layout width error: Parent=".concat(e.constructor.name,", Child=").concat(t.constructor.name)),t.height<t.childrenHeight&&console.warn("Layout height error: Parent=".concat(e.constructor.name,", Child=").concat(t.constructor.name)));},Hm={},Um={},Nm=Phaser.Utils.Objects.IsPlainObject,Km=Phaser.Utils.Objects.GetValue,Jm=Phaser.Display.Align.CENTER,qm=Phaser.Utils.String.UUID,Zm={add:function(t,e,i,n,s,r,o,a,h,l){(zp.call(this,t),Nm(e))&&(e=Km(u=e,"key",void 0),i=Km(u,"align",Jm),n=Km(u,"padding",0),s=Km(u,"expand",!0),t.isRexSizer||(r=Km(u,"minWidth",t._minWidth),o=Km(u,"minHeight",t._minHeighted)),a=Km(u,"offsetX",0),h=Km(u,"offsetY",0),l=Km(u,"aspectRatio",0));var u,c=void 0!==e;return c||(e=qm()),"string"==typeof i&&(i=rp[i]),void 0===i&&(i=Jm),void 0===n&&(n=0),void 0===s&&(s=!0),t.isRexSizer||(void 0===r&&(r=t._minWidth),void 0===o&&(o=t._minHeight)),void 0===a&&(a=0),void 0===h&&(h=0),void 0===l?l=0:!0===l&&(l=Vr(t)/Yr(t)),l>0&&(s=!0,void 0===r&&(r=0),void 0===o&&(o=0)),(u=this.getSizerConfig(t)).align=i,u.padding=Ip(n),Nm(s)?(u.expandWidth=Km(s,"width",!1),u.expandHeight=Km(s,"height",!1)):(u.expandWidth=s,u.expandHeight=s),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===r?Vr(t):r),u.expandHeight&&(t.minHeight=void 0===o?Yr(t):o)),u.alignOffsetX=a,u.alignOffsetY=h,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},$m=ip.prototype.clear,Qm=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),$m.call(this,t),i)for(var n,s=0,r=e.length;s<r;s++)(n=e[s]).emit("sizer.remove",n,this),this.emit("remove",n,this);return this},tk={remove:function(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else {if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t);}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Xp.call(this,t,e),this},removeAll:function(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear:function(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return Qm.call(this,t),this}},ek={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,s=this.sizerChildren,r=!1;for(var o in s)t=s[o],void 0===(i=this.getChildWidth(t))&&(r=!0),r||(i+=(e=t.rexSizer.padding).left+e.right,n=Math.max(i,n));return r?void 0:n+this.space.left+this.space.right},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,s=this.sizerChildren,r=!1;for(var o in s)t=s[o],void 0===(i=this.getChildHeight(t))&&(r=!0),r||(i+=(e=t.rexSizer.padding).top+e.bottom,n=Math.max(i,n));return r?void 0:n+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer;if(n.expandWidth){var s=this.space,r=e-s.left-s.right,o=n.padding;i=r-o.left-o.right;}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer;if(n.expandHeight){var s=this.space,r=e-s.top-s.bottom,o=n.padding;i=r-o.top-o.bottom;}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var n in i)(e=i[n]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,n,s,r,o,a,h,l,u=this.innerLeft,c=this.innerTop,d=this.innerWidth,f=this.innerHeight,p=this.sizerChildren;for(var v in p)(t=p[v]).rexSizer.hidden||(i=(e=t.rexSizer).padding,$g.call(this,t),a=this.getExpandedChildWidth(t),h=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Hm.width=e.aspectRatio,Hm.height=1,Um.width=a,Um.height=h,a=(l=Ym(Hm,Um,!0,!0)).width,h=l.height),t.isRexSizer?(t.runLayout(this,a,h),Xm(t,this)):uv(t,a,h),n=u+i.left,r=d-i.left-i.right,s=c+i.top,o=f-i.top-i.bottom,Qg.call(this,t,n,s,r,o,e.align,e.alignOffsetX,e.alignOffsetY));}};Object.assign(ek,Zm,tk);var ik=function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null},nk=Phaser.Utils.Objects.IsPlainObject,sk=Phaser.Utils.Objects.GetValue,rk=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),nk(n)?(n=sk(a=n,"x",0),s=sk(a,"y",0),r=sk(a,"width",void 0),o=sk(a,"height",void 0)):nk(r)&&(r=sk(a=r,"width",void 0),o=sk(a,"height",void 0)),(l=t(this,i,[e,n,s,r,o,a])).type="rexOverlapSizer",l.sizerChildren={},l.addChildrenMap("items",l.sizerChildren),l}return d(i,e),u(i,[{key:"childToKey",value:function(t){if("string"!=typeof t)return ik(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}]),i}(Vm);Object.assign(rk.prototype,ek);var ok=Phaser.Math.Distance.Between,ak=function(t,e,i){var n=t.width/2;return ok(n,n,e,i)<=n},hk=Phaser.Math.Angle.Between,lk=Phaser.Math.Angle.Normalize,uk=function(t,e,i){if(this.enable&&t.isDown){var n=this.sizerChildren.knob;if(ak(n,e,i)){var s=n.width/2,r=n.startAngle,o=hk(s,s,e,i),a=n.anticlockwise?r-o:o-r,h=lk(a)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h);}}},ck=function(){this.sizerChildren.knob.on("pointerdown",uk,this).on("pointermove",uk,this).setInteractive();},dk=Phaser.Math.Angle.Between,fk=Phaser.Math.Angle.Wrap,pk=function(t,e,i){if(this.enable&&!this.panPointer){var n=this.sizerChildren.knob;ak(n,e,i)&&yk.call(this,t);}},vk=function(t,e,i){if(this.enable&&t.isDown){var n=this.sizerChildren.knob;switch(this.panState){case bk:ak(n,e,i)&&yk.call(this,t);break;case xk:ak(n,e,i)?kk.call(this):mk.call(this);}}},gk=function(t,e,i){this.enable&&this.panPointer===t&&mk.call(this);},yk=function(t){this.panPointer=t,this.panState=xk;},mk=function(){this.panPointer=void 0,this.panState=bk;},kk=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,n=dk(i.x,i.y,t.x,t.y),s=dk(i.x,i.y,e.x,e.y),r=i.anticlockwise?n-s:s-n,o=fk(r)/(2*Math.PI);this.stopEaseValue(),this.value+=o;},bk=0,xk=1,Ck=function(){this.sizerChildren.knob.on("pointerdown",pk,this).on("pointermove",vk,this).on("pointerup",gk,this).setInteractive(),this.panPointer=void 0,this.panState=bk;},wk=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},Sk={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:wk,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(wk.call(this,t)),e.layout&&e.layout()),this}},Pk=Phaser.Utils.Objects.GetValue,Tk=Phaser.Math.Snap.To,Ok=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),(s=t(this,i,[e,n])).type="rexKnob",s.bootProgressBase(n);var r=Pk(n,"background",void 0),o=Pk(n,"text",void 0);r&&s.addBackground(r),o&&(n.textColor=void 0,n.textStrokeColor=void 0,s.setTextFormatCallback(Pk(n,"textFormatCallback",void 0),Pk(n,"textFormatCallbackScope",void 0)));var a=new ud(e,n);a.setDepth(Pk(n,"knobDepth",0)),a._value=-1,e.add.existing(a),s.add(a,"knob"),o&&(s.add(o,"text","center",0,!1),e.children.moveBelow(a,o)),s.addChildrenMap("background",r),s.addChildrenMap("knob",a),s.addChildrenMap("text",o),s.setEnable(Pk(n,"enable",void 0)),s.setGap(Pk(n,"gap",void 0)),s.setValue(Pk(n,"value",0),Pk(n,"min",void 0),Pk(n,"max",void 0));var l=Pk(n,"input",0);switch("string"==typeof l&&(l=Mk[l]),l){case 0:Ck.call(v(s));break;case 1:ck.call(v(s));}return s}return d(i,e),u(i,[{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setGap",value:function(t){return this.gap=t,this}},{key:"value",get:function(){return this.sizerChildren.knob.value},set:function(t){void 0!==this.gap&&(t=Tk(t,this.gap));var e=this.value;this.sizerChildren.knob.value=t;var i=this.value;e!==i&&(this.updateText(),this.eventEmitter.emit("valuechange",i,e,this.eventEmitter));}}]),i}(ed(rk)),Mk={pan:0,drag:0,click:1,none:-1};Object.assign(Ok.prototype,Sk),E.register("knob",(function(t){var e=new Ok(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Knob",Ok);var Ek,_k,Rk={arc:Bu,circle:Du,curve:Iu,ellipse:ju,line:zu,lines:rc,rectangle:ac,roundRectangle:lc,triangle:cc},Lk=Phaser.Utils.Objects.GetValue,Bk=Phaser.Utils.Objects.IsPlainObject,Dk=function(){for(var t=this.getShapes(),e=0,i=t.length;e<i;e++)t[e].lineStyle().fillStyle();},Ik={createShape:function(t,e){var i=new(Rk[t]);return e&&i.setName(e),i},buildShapes:function(t){var e=Lk(t,"create",void 0);if(Bk(e)){var i=e;for(var n in i){var s=i[n];switch(o(s)){case"number":for(var r=0;r<s;r++)this.addShape(this.createShape(n));break;case"string":this.addShape(this.createShape(n,s));break;default:for(var a=s,h=(r=0,a.length);r<h;r++)this.addShape(this.createShape(n,a[r]));}}}else if(Array.isArray(e))for(r=0,h=(i=e).length;r<h;r++){var l=i[r];this.addShape(this.createShape(l.type,l.name));}else "function"==typeof e&&e.call(this);this.setUpdateShapesCallback(Lk(t,"update"));},setUpdateShapesCallback:function(t){return void 0===t&&(t=Dk),this.dirty=this.dirty||this.updateCallback!==t,this.updateCallback=t,this},updateShapes:function(){this.updateCallback.call(this);}},jk=Phaser.GameObjects.Components.TransformMatrix,zk=Phaser.Math.TransformXY,Ak={},Fk=Phaser.Utils.Objects.GetValue,Wk=Phaser.Utils.Objects.IsPlainObject,Vk=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),Wk(n)&&(n=Fk(a=n,"x",0),s=Fk(a,"y",0),r=Fk(a,"width",2),o=Fk(a,"height",2)),(l=t(this,i,[e,n,s,r,o])).type=Fk(a,"type","rexCustomShapes"),l.buildShapes(a),l}return d(i,e),u(i,[{key:"centerX",get:function(){return this.width/2}},{key:"centerY",get:function(){return this.height/2}},{key:"worldToLocalXY",value:function(t,e,i,n){return "boolean"==typeof i&&(n=i,i=void 0),function(t,e,i,n,s){void 0===n&&(n=t.scene.cameras.main),void 0===s?s={}:!0===s&&(s=Ak);var r=n.scrollX,o=n.scrollY,a=e+r*t.scrollFactorX-r,h=i+o*t.scrollFactorY-o;return t.parentContainer?(void 0===Ek&&(Ek=new jk,_k=new jk),t.getWorldTransformMatrix(Ek,_k),Ek.applyInverse(a,h,s)):zk(a,h,t.x,t.y,t.rotation,t.scaleX,t.scaleY,s),s.x+=t.displayOriginX,s.y+=t.displayOriginY,s}(this,t,e,i,n)}}]),i}(Tu);Object.assign(Vk.prototype,Ik),E.register("customShapes",(function(t,e,i,n,s){var r=new Vk(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.CustomShapes",Vk);var Yk=Phaser.Utils.Objects.GetValue,Gk=Phaser.Utils.Objects.IsPlainObject,Xk=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),Gk(n)&&(n=Yk(a=n,"x",0),s=Yk(a,"y",0),r=Yk(a,"width",2),o=Yk(a,"height",2)),void 0===a&&(a={}),a.type||(a.type="rexCustomProgress"),(l=t(this,i,[e,n,s,r,o,a])).bootProgressBase(a),l.setValue(Yk(a,"value",0)),l}return d(i,e),u(i,[{key:"centerX",get:function(){return this.width/2}},{key:"centerY",get:function(){return this.height/2}},{key:"radius",get:function(){return Math.min(this.centerX,this.centerY)}}]),i}(ed(Vk));E.register("customProgress",(function(t,e,i,n,s){var r=new Xk(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.CustomProgress",Xk);var Hk=Phaser.Utils.Objects.IsPlainObject,Uk=Phaser.Utils.Objects.GetValue,Nk=Phaser.Utils.Array.GetRandom,Kk={out:0,in:1},Jk=function(t,e){for(var i=0,n=arguments.length<=2?0:arguments.length-2;i<n;i++){var s=i+2<2||arguments.length<=i+2?void 0:arguments[i+2];if(s&&s.hasOwnProperty(t))return s[t]}return e},qk={setTransitionDirection:function(t){return "string"==typeof t&&(t=Kk[t]),this.dir=t,this},setDuration:function(t){return this.duration=t,this},setEaseFunction:function(t){return this.easeFunction=t,this},setNextTexture:function(t,e){return this.nextImage.setTexture(t,e),this},transit:function(t,e,i){if(this.isRunning&&(this.ignoreCompleteEvent=!0,this.stop(),this.ignoreCompleteEvent=!1),void 0!==i&&(t={key:t,frame:e,mode:i}),this.currentTransitionMode=void 0,Hk(t)){var n,s=t;t=Uk(s,"key",void 0),e=Uk(s,"frame",void 0),i=Uk(s,"mode"),Array.isArray(i)&&(i=Nk(i)),this.transitionModes&&this.transitionModes.hasOwnProperty(i)&&(n=this.transitionModes[i],this.currentTransitionMode=i),this.setDuration(Jk("duration",this.duration,s,n)).setEaseFunction(Jk("ease",this.easeFunction,s,n)).setTransitionDirection(Jk("dir",this.dir,s,n));var r=Jk("mask",void 0,s,n);r&&this.setMaskGameObject(r),this.setMaskEnable(!0===r);var o=Jk("onStart",void 0,s,n),a=Jk("onProgress",void 0,s,n),h=Jk("onComplete",void 0,s,n);void 0===o&&void 0===a&&void 0===h||this.setTransitionStartCallback(o,Jk("onStartScope",void 0,s,n)).setTransitionProgressCallback(a,Jk("onProgressScope",void 0,s,n)).setTransitionCompleteCallback(h,Jk("onCompleteScope",void 0,s,n));}return this.setNextTexture(t,e),this.start(),this},addTransitionMode:function(t,e){return void 0===this.transitionModes&&(this.transitionModes={}),Hk(t)&&(t=(e=t).name,delete e.name),this.transitionModes[t]=e,this},start:function(){return void 0===this.easeValueTask&&(this.easeValueTask=new vc(this,{eventEmitter:null})),this.easeValueTask.restart({key:"t",from:0,to:1,duration:this.duration,ease:this.easeFunction}),this},pause:function(){return this.easeValueTask&&this.easeValueTask.pause(),this},resume:function(){return this.easeValueTask&&this.easeValueTask.resume(),this},stop:function(){return this.easeValueTask&&this.easeValueTask.stop(),this.setT(1),this}},Zk=function(t,e,i,n,s){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var r=Math.min(t,e)/2;this.fillCircle(-t*(n-.5),-e*(s-.5),r+i);}else this.fillRect(-t*n-i.left,-e*s-i.top,t+i.left+i.right,e+i.top+i.bottom);},$k=function(e){function i(e,n,s){var r;return h(this,i),void 0===n&&(n=0),"string"==typeof n&&(n=Qk[n]),(r=t(this,i,[e.scene])).parent=e,r.shapeType=n,r.padding=Ip(s),r.setPosition().resize().setVisible(!1),r}return d(i,e),u(i,[{key:"destroy",value:function(){return this.parent=void 0,m(f(i.prototype),"destroy",this).call(this),this}},{key:"setPosition",value:function(t,e){var n=this.parent;return void 0===t&&(t=n.x),void 0===e&&(e=n.y),m(f(i.prototype),"setPosition",this).call(this,t,e),this}},{key:"resize",value:function(t,e,i){var n=this.parent;void 0===t&&(t=n.width),void 0===e&&(e=n.height),void 0===i?i=this.padding:"number"==typeof i&&(i=Ip(i));var s=this.width!==t||this.height!==e,r=this.padding!==i&&!$l(this.padding,i);return s||r?(this.width=t,this.height=e,r&&ni(i,this.padding),this.originX=n.originX,this.originY=n.originY,Zk.call(this,t,e,i,n.originX,n.originY),this):this}},{key:"setOrigin",value:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Zk.call(this,this.width,this.height,this.padding,t,e)),this}}]),i}(Phaser.GameObjects.Graphics),Qk={rectangle:0,circle:1},tb={setMaskGameObject:function(t){if(!t)return this.removeMaskGameObject(),this;if(this.maskGameObject){if(!0===t&&this.maskGameObject instanceof $k)return this;if(this.maskGameObject===t)return this;this.removeMaskGameObject();}return !0===t&&(t=new $k(this)),t.resize(this.width,this.height).setOrigin(this.originX,this.originY).setPosition(0,0).setScale(1).setVisible(!1),this.addLocal(t),this.maskGameObject=t,t._maskObject||(t._maskObject=t.createGeometryMask(),t.once("destroy",(function(){t._maskObject.destroy(),t._maskObject=void 0;}))),this.childrenMask=t._maskObject,this},removeMaskGameObject:function(t){return void 0===t&&(t=!0),this.backImage.clearMask(),this.frontImage.clearMask(),this.childrenMask=void 0,this.remove(this.maskGameObject,t),this.maskGameObject=void 0,this},setImageMaskEnable:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!1),e?(this.childrenMask||this.setMaskGameObject(!0),t.setMask(this.childrenMask),this.childrenMask.setInvertAlpha(i)):t.clearMask(),this},setCurrentImageMaskEnable:function(t,e){return this.setImageMaskEnable(this.currentImage,t,e),this},setNextImageMaskEnable:function(t,e){return this.setImageMaskEnable(this.nextImage,t,e),this},setCellImagesMaskEnable:function(t,e){for(var i=this.getCellImages(),n=0,s=i.length;n<s;n++)this.setImageMaskEnable(i[n],t,e);return this},setMaskEnable:function(t,e){return this.setImageMaskEnable(this.backImage,t,e),this.setImageMaskEnable(this.frontImage,t,e),this.setCellImagesMaskEnable(t,e),this}},eb=function(t,e,i,n,s,r){var a,h;null==i&&(i="__BASE"),r||(h=r,"object"===o(a=i)&&(a=a.name),void 0===h&&(h=","),r="__BASE"===a?function(t,e){return "".concat(t).concat(h).concat(e)}:function(t,e){return "".concat(a,"_").concat(t).concat(h).concat(e)});for(var l,u,c,d=t.sys.textures.get(e),f="object"===o(i)?i:d.get(i),p=f.width/n,v=f.height/s,g=f.cutX,y=f.cutY,m=0,k=0,b=0;b<s;b++){m=0;for(var x=0;x<n;x++)c=r(x,b),l=m+g,u=k+y,d.add(c,0,l,u,p,v),m+=p;k+=v;}return {getFrameNameCallback:r,cellWidth:p,cellHeight:v,columns:n,rows:s}},ib=Phaser.Utils.Objects.GetValue,nb=Phaser.GameObjects.Image,sb=Phaser.Utils.Objects.IsPlainObject,rb=Phaser.Math.RotateAround,ob={gridCutImage:function(t,e,i,n){void 0===n&&(n={}),n.objectPool=this.imagesPool;for(var s,r=function(t,e,i,n){sb(e)&&(e=ib(n=e,"columns",1),i=ib(n,"rows",1));var s=ib(n,"createImageCallback");if(!s){var r=ib(n,"ImageClass",nb);s=function(t,e,i){return new r(t,0,0,e,i)};}for(var o=ib(n,"originX",.5),a=ib(n,"originY",.5),h=ib(n,"add",!0),l=ib(n,"align",h),u=ib(n,"objectPool",void 0),c=t.scene,d=t.texture,f=t.frame,p=eb(c,d,f,e,i),v=p.getFrameNameCallback,g=t.scaleX,y=t.scaleY,m=t.rotation,k=t.getTopLeft(),b=k.x,x=k.y,C=[],w=p.cellWidth*g,S=p.cellHeight*y,P=0;P<i;P++)for(var T=0;T<e;T++){var O,M=v(T,P);if(O=u&&u.length>0?u.pop().setTexture(d,M):s(c,d,M),h&&c.add.existing(O),l){var E=b+w*T+o*w,_=x+S*P+a*S;O.setOrigin(o,a).setPosition(E,_).setScale(g,y).setRotation(m),rb(O,b,x,m);}C.push(O);}return C}(t,e,i,n),o=0,a=r.length;o<a;o++)(s=r[o]).setVisible(!0),this.add(s);return this.cellImages=r,this.setChildLocalVisible(t,!1),r},gridCutCurrentImage:function(t,e,i){return this.gridCutImage(this.currentImage,t,e,i)},gridCutNextImage:function(t,e,i){return this.gridCutImage(this.nextImage,t,e,i)},getCellImages:function(){return this.cellImages},freeCellImages:function(){var t;if(0===this.cellImages.length)return this;for(var e,i,n=this.cellImages[0].texture,s=this.cellImages,r=0,o=s.length;r<o;r++)e=s[r],this.setChildLocalAlpha(e,1).setChildLocalScale(e,1).setChildLocalVisible(e,!1),e.clearMask(),i=e.frame.name,e.setTexture(),n.remove(i);return (t=this.imagesPool).push.apply(t,w(s)),s.length=0,this}},ab={setFlipX:function(t){return this.flipX=t,this},setFlipY:function(t){return this.flipY=t,this},toggleFlipX:function(){return this.flipX=!this.flipX,this},toggleFlipY:function(){return this.flipY=!this.flipY,this},setFlip:function(t,e){return this.flipX=t,this.flipY=e,this},resetFlip:function(){return this.flipX=!1,this.flipY=!1,this}},hb={};Object.assign(hb,{setTransitionStartCallback:function(t,e){return this.onStartCallback=t,this.onStartCallbackScope=e,this},setTransitionProgressCallback:function(t,e){return this.onProgressCallback=t,this.onProgressCallbackScope=e,this},setTransitionCompleteCallback:function(t,e){return this.onCompleteCallback=t,this.onCompleteCallbackScope=e,this}},qk,tb,ob,ab);var lb=function(t,e,i,n){},ub=function(t,e,i,n){t.setChildLocalAlpha(e,1-n).setChildLocalAlpha(i,n);},cb=function(t,e,i,n){t.setChildLocalAlpha(e,1);},db=Phaser.Utils.Objects.IsPlainObject,fb=Phaser.Utils.Objects.GetValue,pb=Phaser.Math.Clamp,vb=function(e){function i(e,n,s,r,o,a){var l;h(this,i),db(n)?(n=fb(a=n,"x",0),s=fb(a,"y",0),r=fb(a,"key",void 0),o=fb(a,"frame",void 0)):db(o)&&(a=o,o=void 0);var u=fb(a,"back",void 0),c=fb(a,"front",void 0);u||(u=e.add.image(n,s,r,o)),c||(c=e.add.image(n,s,r,o)),(l=t(this,i,[e,n,s,fb(a,"width",c.width),fb(a,"height",c.height)])).type="rexTransitionImage",u.setVisible(!1),l.addMultiple([u,c]),l.backImage=u,l.frontImage=c,l.maskGameObject=void 0,l.cellImages=[],l.imagesPool=[],l.transitionModes=void 0,l.currentTransitionMode=void 0;var d=fb(a,"onStart",void 0),f=fb(a,"onProgress",void 0),p=fb(a,"onComplete",void 0),v=fb(a,"dir",0);void 0===d&&void 0===f&&void 0===p&&(d=lb,f=ub,p=cb,v=0),l.setTransitionStartCallback(d,fb(a,"onStartScope",void 0)).setTransitionProgressCallback(f,fb(a,"onProgressScope",void 0)).setTransitionCompleteCallback(p,fb(a,"onCompleteScope",void 0)).setTransitionDirection(v).setDuration(fb(a,"duration",1e3)).setEaseFunction(fb(a,"ease","Linear"));var g=fb(a,"mask",void 0);return g&&l.setMaskGameObject(g),l.setMaskEnable(!1),l.ignoreCompleteEvent=!1,l}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.childrenMask&&(this.childrenMask.destroy(),this.childrenMask=void 0),this.backImage=void 0,this.frontImage=void 0,this.maskGameObject=void 0,this.cellImages.length=0,this.imagesPool.length=0,this.transitionModes=void 0,m(f(i.prototype),"destroy",this).call(this,t),this.onStartCallback=void 0,this.onStartCallbackScope=void 0,this.onProgressCallback=void 0,this.onProgressCallbackScope=void 0,this.onCompleteCallback=void 0,this.onCompleteCallbackScope=void 0,this.easeValueTask=void 0);}},{key:"currentImage",get:function(){return 0===this.dir?this.frontImage:this.backImage}},{key:"nextImage",get:function(){return 0===this.dir?this.backImage:this.frontImage}},{key:"texture",get:function(){return this.nextImage.texture}},{key:"frame",get:function(){return this.nextImage.frame}},{key:"flipX",get:function(){return this._flipX},set:function(t){this._flipX!==t&&(this._flipX=t,this.backImage.setFlipX(t),this.frontImage.setFlipX(t));}},{key:"flipY",get:function(){return this._flipY},set:function(t){this._flipY!==t&&(this._flipY=t,this.backImage.setFlipY(t),this.frontImage.setFlipY(t));}},{key:"t",get:function(){return this._t},set:function(t){if(t=pb(t,0,1),this._t!==t){this._t=t;var e=this.currentImage,i=this.nextImage;if(0===t&&(this.setChildVisible(this.frontImage,!0).setChildVisible(this.backImage,!0),gb(this.onStartCallback,this.onStartCallbackScope,this,e,i,t)),gb(this.onProgressCallback,this.onProgressCallbackScope,this,e,i,t),1===t){gb(this.onCompleteCallback,this.onCompleteCallbackScope,this,e,i,t);var n=i.texture.key,s=i.frame.name;this.frontImage.setTexture(n,s),this.backImage.setTexture(n,s),this.setChildVisible(this.frontImage,!0).setChildVisible(this.backImage,!1).setMaskEnable(!1).freeCellImages();}1!==t||this.ignoreCompleteEvent||this.emit("complete");}}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isRunning",get:function(){return !!this.easeValueTask&&this.easeValueTask.isRunning}},{key:"setOrigin",value:function(t,e){return m(f(i.prototype),"setOrigin",this).call(this,t,e),this.backImage.setOrigin(t,e),this.frontImage.setOrigin(t,e),this.maskGameObject&&this.maskGameObject.setOrigin(t,e),this}},{key:"setTexture",value:function(t,e){return this.frontImage.setTexture(t,e),this.backImage.setTexture(t,e).setVisible(!1),this}}]),i}(ip),gb=function(t,e,i,n,s,r){t&&(e?t.call(e,i,n,s,r):t(i,n,s,r));};Object.assign(vb.prototype,hb),E.register("transitionImage",(function(t,e,i,n,s){var r=new vb(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.TransitionImage",vb);var yb="#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n// Scene buffer\nuniform sampler2D uMainSampler;\nuniform sampler2D uMainSampler2;\n\nuniform int resizeMode;\nuniform float progress;\nuniform float fromRatio;\nuniform float toRatio;\nvarying vec2 outFragCoord;\n// Effect parameters\nuniform float noiseX;\nuniform float noiseY;\nuniform float noiseZ;\nuniform float fromEdgeStart;\nuniform float fromEdgeWidth;\nuniform float toEdgeStart;\nuniform float toEdgeWidth;\n\n".concat("vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x*34.0)+1.0)*x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nvec3 fade(vec3 t) { return t*t*t*(t*(t*6.0-15.0)+10.0); }\nfloat Perlin(vec3 P) {\n    vec3 i0 = mod289(floor(P)), i1 = mod289(i0 + vec3(1.0));\n    vec3 f0 = fract(P), f1 = f0 - vec3(1.0), f = fade(f0);\n    vec4 ix = vec4(i0.x, i1.x, i0.x, i1.x), iy = vec4(i0.yy, i1.yy);\n    vec4 iz0 = i0.zzzz, iz1 = i1.zzzz;\n    vec4 ixy = permute(permute(ix) + iy), ixy0 = permute(ixy + iz0), ixy1 = permute(ixy + iz1);\n    vec4 gx0 = ixy0 * (1.0 / 7.0), gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n    vec4 gx1 = ixy1 * (1.0 / 7.0), gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n    gx0 = fract(gx0); gx1 = fract(gx1);\n    vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0), sz0 = step(gz0, vec4(0.0));\n    vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1), sz1 = step(gz1, vec4(0.0));\n    gx0 -= sz0 * (step(0.0, gx0) - 0.5); gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n    gx1 -= sz1 * (step(0.0, gx1) - 0.5); gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n    vec3 g0 = vec3(gx0.x,gy0.x,gz0.x), g1 = vec3(gx0.y,gy0.y,gz0.y),\n        g2 = vec3(gx0.z,gy0.z,gz0.z), g3 = vec3(gx0.w,gy0.w,gz0.w),\n        g4 = vec3(gx1.x,gy1.x,gz1.x), g5 = vec3(gx1.y,gy1.y,gz1.y),\n        g6 = vec3(gx1.z,gy1.z,gz1.z), g7 = vec3(gx1.w,gy1.w,gz1.w);\n    vec4 norm0 = taylorInvSqrt(vec4(dot(g0,g0), dot(g2,g2), dot(g1,g1), dot(g3,g3)));\n    vec4 norm1 = taylorInvSqrt(vec4(dot(g4,g4), dot(g6,g6), dot(g5,g5), dot(g7,g7)));\n    g0 *= norm0.x; g2 *= norm0.y; g1 *= norm0.z; g3 *= norm0.w;\n    g4 *= norm1.x; g6 *= norm1.y; g5 *= norm1.z; g7 *= norm1.w;\n    vec4 nz = mix(vec4(dot(g0, vec3(f0.x, f0.y, f0.z)), dot(g1, vec3(f1.x, f0.y, f0.z)),\n        dot(g2, vec3(f0.x, f1.y, f0.z)), dot(g3, vec3(f1.x, f1.y, f0.z))),\n        vec4(dot(g4, vec3(f0.x, f0.y, f1.z)), dot(g5, vec3(f1.x, f0.y, f1.z)),\n            dot(g6, vec3(f0.x, f1.y, f1.z)), dot(g7, vec3(f1.x, f1.y, f1.z))), f.z);\n    return 2.2 * mix(mix(nz.x,nz.z,f.y), mix(nz.y,nz.w,f.y), f.x);\n}\nfloat Perlin(vec2 P) { return Perlin(vec3(P, 0.0)); }\n","\n\nvec4 getFromColor (vec2 uv) {\n  return texture2D(uMainSampler, uv);\n}\n\nvec4 getToColor (vec2 uv) {\n  if (resizeMode == 2) {\n    //  cover\n    return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(min(fromRatio / toRatio, 1.0), min((toRatio / fromRatio), 1.0)));\n  } else if (resizeMode == 1) {\n    //  contain\n    return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(max(fromRatio / toRatio, 1.0), max((toRatio / fromRatio), 1.0)));\n  } else {\n    //  stretch\n    return texture2D(uMainSampler2, vec2(uv.x, 1.0 - uv.y));\n  }\n}\n\nvec4 transition (vec2 uv) {    \n  vec4 colorFront = getFromColor(uv);\n  vec4 colorTo = getToColor(uv);\n\n  float noise = (Perlin(vec3(uv.x * noiseX, uv.y * noiseY, noiseZ)) + 1.0) / 2.0\n    * (1.0 - (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth))\n    + (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth) * 0.5;\n  vec4 colorResult = colorFront * smoothstep(progress - (fromEdgeStart + fromEdgeWidth), progress - fromEdgeStart, noise)\n    + colorTo * smoothstep((1.0 - progress) - (toEdgeStart + toEdgeWidth), (1.0 - progress) - toEdgeStart, (1.0 - noise));\n  return colorResult;\n}\n\nvoid main () {\n  vec2 uv = outFragCoord;\n  gl_FragColor = transition(uv);\n}\n"),mb=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,kb=Phaser.Utils.Objects.GetValue,bb=Phaser.Math.Clamp,xb=function(e){function i(e){var n;return h(this,i),(n=t(this,i,[{name:"rexDissolvePostFx",game:e,renderTarget:!0,fragShader:yb}]))._progress=0,n.toFrame=null,n.targetTexture=null,n.resizeMode=1,n.toRatio=1,n.noiseX=0,n.noiseY=0,n.noiseZ=0,n.fromEdgeStart=.01,n.fromEdgeWidth=.05,n.toEdgeStart=.01,n.toEdgeWidth=.05,n}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.setProgress(kb(t,"progress",0)),this.setTransitionTargetTexture(kb(t,"toTexture","__DEFAULT"),kb(t,"toFrame",void 0),kb(t,"resizeMode",1)),this.setNoise(kb(t,"noiseX",void 0),kb(t,"noiseY",void 0),kb(t,"noiseZ",void 0)),this.setFromEdge(kb(t,"fromEdgeStart",.01),kb(t,"fromEdgeWidth",.05)),this.setToEdge(kb(t,"toEdgeStart",.01),kb(t,"toEdgeWidth",.05)),this}},{key:"onBoot",value:function(){}},{key:"onPreRender",value:function(){this.set1f("progress",this.progress),this.set1i("resizeMode",this.resizeMode),this.set1f("noiseX",this.noiseX),this.set1f("noiseY",this.noiseY),this.set1f("noiseZ",this.noiseZ),this.set1f("fromEdgeStart",this.fromEdgeStart),this.set1f("fromEdgeWidth",this.fromEdgeWidth),this.set1f("toEdgeStart",this.toEdgeStart),this.set1f("toEdgeWidth",this.toEdgeWidth);}},{key:"onDraw",value:function(t){this.set1f("fromRatio",t.width/t.height),this.set1f("toRatio",this.toRatio),this.set1i("uMainSampler2",1),this.bindTexture(this.targetTexture,1),this.bindAndDraw(t);}},{key:"progress",get:function(){return this._progress},set:function(t){this._progress=bb(t,0,1);}},{key:"setProgress",value:function(t){return this.progress=t,this}},{key:"setTransitionTargetTexture",value:function(t,e,i){void 0===t&&(t="__DEFAULT");var n=this.game.textures.getFrame(t,e);return n||(n=this.game.textures.getFrame("__DEFAULT")),this.toRatio=n.width/n.height,this.toFrame=n,this.targetTexture=n.glTexture,void 0!==i&&(this.resizeMode=i),this}},{key:"setResizeMode",value:function(t){return "string"==typeof t&&(t=Cb[t]),this.resizeMode=t,this}},{key:"setNoise",value:function(t,e,i){return void 0===t&&(t=4+6*Math.random()),void 0===e&&(e=4+6*Math.random()),void 0===i&&(i=10*Math.random()),this.noiseX=t,this.noiseY=e,this.noiseZ=i,this}},{key:"setFromEdge",value:function(t,e){return this.fromEdgeStart=t,this.fromEdgeWidth=e,this}},{key:"setToEdge",value:function(t,e){return this.toEdgeStart=t,this.toEdgeWidth=e,this}}]),i}(mb),Cb={stretch:0,contain:1,cover:2},wb=Phaser.Utils.Array.SpliceOne,Sb=.1,Pb=[function(t){t.addTransitionMode("slideAwayRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=e.width*n;t.setChildLocalPosition(e,s,0);},onComplete:function(t,e,i,n){t.setChildLocalPosition(e,0,0);}}).addTransitionMode("slideAwayLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=e.width*-n;t.setChildLocalPosition(e,s,0);},onComplete:function(t,e,i,n){t.setChildLocalPosition(e,0,0);}}).addTransitionMode("slideAwayDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=e.height*n;t.setChildLocalPosition(e,0,s);},onComplete:function(t,e,i,n){t.setChildLocalPosition(e,0,0);}}).addTransitionMode("slideAwayUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=e.height*-n;t.setChildLocalPosition(e,0,s);},onComplete:function(t,e,i,n){t.setChildLocalPosition(e,0,0);}});},function(t){t.addTransitionMode("slideRight",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=i.width*(n-1);t.setChildLocalPosition(i,s,0);},onComplete:function(t,e,i,n){t.setChildLocalPosition(i,0,0);}}).addTransitionMode("slideLeft",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=i.width*(1-n);t.setChildLocalPosition(i,s,0);},onComplete:function(t,e,i,n){t.setChildLocalPosition(i,0,0);}}).addTransitionMode("slideDown",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=i.height*(n-1);t.setChildLocalPosition(i,0,s);},onComplete:function(t,e,i,n){t.setChildLocalPosition(i,0,0);}}).addTransitionMode("slideUp",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=i.height*(1-n);t.setChildLocalPosition(i,0,s);},onComplete:function(t,e,i,n){t.setChildLocalPosition(i,0,0);}});},function(t){t.addTransitionMode("pushRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=e.width*n;t.setChildLocalPosition(e,s,0);s=i.width*(n-1);t.setChildLocalPosition(i,s,0);},onComplete:function(t,e,i,n){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0);}}).addTransitionMode("pushLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=e.width*-n;t.setChildLocalPosition(e,s,0);s=i.width*(1-n);t.setChildLocalPosition(i,s,0);},onComplete:function(t,e,i,n){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0);}}).addTransitionMode("pushDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=e.height*n;t.setChildLocalPosition(e,0,s);s=i.height*(n-1);t.setChildLocalPosition(i,0,s);},onComplete:function(t,e,i,n){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0);}}).addTransitionMode("pushUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=e.height*-n;t.setChildLocalPosition(e,0,s);s=i.height*(1-n);t.setChildLocalPosition(i,0,s);},onComplete:function(t,e,i,n){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0);}});},function(t){t.addTransitionMode("zoomOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=1-n;t.setChildLocalScale(e,s,s);},onComplete:function(t,e,i,n){t.setChildLocalScale(e,1,1);}}).addTransitionMode("zoomIn",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){var s=n;t.setChildLocalScale(i,s,s);},onComplete:function(t,e,i,n){t.setChildLocalScale(i,1,1);}}).addTransitionMode("zoomInOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,n){i.tint=0;},onProgress:function(t,e,i,n){var s;n<.5?(s=1-ha(n),t.setChildLocalScale(e,s,s)):(e.visible&&t.setChildVisible(e,!1),s=1-ha(n),t.setChildLocalScale(i,s,s));},onComplete:function(t,e,i,n){t.setChildLocalScale(e,1,1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildLocalScale(i,1,1),t.setChildVisible(i,!0),i.tint=16777215;}});},function(t){t.addTransitionMode("fade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,n){i.tint=0;},onProgress:function(t,e,i,n){var s;n<.5?(n=ha(n),s=Math.floor(255*(1-n)),e.tint=(s<<16)+(s<<8)+s):(e.visible&&t.setChildVisible(e,!1),n=ha(n),s=Math.floor(255*(1-n)),i.tint=(s<<16)+(s<<8)+s);},onComplete:function(t,e,i,n){t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215;}}).addTransitionMode("crossFade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,n){},onProgress:function(t,e,i,n){t.setChildLocalAlpha(e,1-n),t.setChildLocalAlpha(i,n);},onComplete:function(t,e,i,n){t.setChildLocalAlpha(e,1);}});},function(t){var e,i=(e=t.scene,new Xk(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){this.getShape("rect").fillStyle(16777215).setSize(this.width*this.value,this.height*this.value).setCenterPosition(this.centerX,this.centerY);}}));t.once("destroy",(function(){i.destroy();})).addTransitionMode("irisOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,n){t.setCurrentImageMaskEnable(!0,!0);},onProgress:function(t,e,i,n){t.maskGameObject.setValue(n);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1);}}).addTransitionMode("irisIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,n){t.setNextImageMaskEnable(!0,!0);},onProgress:function(t,e,i,n){t.maskGameObject.setValue(1-n);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1);}}).addTransitionMode("irisInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,n){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0);},onProgress:function(t,e,i,n){var s;n<.5?(n=ha(n),s=Math.floor(255*(1-n)),t.maskGameObject.setValue(1-n),e.tint=(s<<16)+(s<<8)+s):(e.visible&&t.setChildVisible(e,!1),n=ha(n),s=Math.floor(255*(1-n)),t.maskGameObject.setValue(1-n),i.tint=(s<<16)+(s<<8)+s);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215;}});},function(t){var e,i=(e=t.scene,new Xk(e,{type:"Graphics",create:[{name:"pie",type:"arc"}],update:function(){var t=2*Math.max(this.width,this.height),e=90*this.value;this.getShape("pie").fillStyle(16777215).setCenterPosition(this.centerX,0).setRadius(t).setAngle(90-e,90+e).setPie();}}));t.once("destroy",(function(){i.destroy();})).addTransitionMode("pieOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,n){t.setCurrentImageMaskEnable(!0,!0);},onProgress:function(t,e,i,n){t.maskGameObject.setValue(n);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1);}}).addTransitionMode("pieIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,n){t.setNextImageMaskEnable(!0,!0);},onProgress:function(t,e,i,n){t.maskGameObject.setValue(1-n);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1);}}).addTransitionMode("pieInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,n){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0);},onProgress:function(t,e,i,n){var s;n<.5?(n=ha(n),s=Math.floor(255*(1-n)),t.maskGameObject.setValue(1-n),e.tint=(s<<16)+(s<<8)+s):(e.visible&&t.setChildVisible(e,!1),n=ha(n),s=Math.floor(255*(1-n)),t.maskGameObject.setValue(1-n),i.tint=(s<<16)+(s<<8)+s);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215;}});},function(t){var e,i=(e=t.scene,new Xk(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){var t=this.getShape("rect").fillStyle(16777215),e=1-this.value;switch(this.wipeMode){case"right":t.setSize(this.width*e,this.height).setTopLeftPosition(this.width-t.width,0);break;case"left":t.setSize(this.width*e,this.height).setTopLeftPosition(0,0);break;case"down":t.setSize(this.width,this.height*e).setTopLeftPosition(0,this.height-t.height);break;case"up":t.setSize(this.width,this.height*e).setTopLeftPosition(0,0);}}}));t.once("destroy",(function(){i.destroy();})).addTransitionMode("wipeRight",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,n){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="right";},onProgress:function(t,e,i,n){t.maskGameObject.setValue(n);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1);}}).addTransitionMode("wipeLeft",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,n){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="left";},onProgress:function(t,e,i,n){t.maskGameObject.setValue(n);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1);}}).addTransitionMode("wipeDown",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,n){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="down";},onProgress:function(t,e,i,n){t.maskGameObject.setValue(n);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1);}}).addTransitionMode("wipeUp",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,n){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="up";},onProgress:function(t,e,i,n){t.maskGameObject.setValue(n);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1);}});},function(t){var e=function(t,e){var i=new Xk(t,{type:"Graphics",create:{rectangle:e},update:function(){for(var t=this.getShapes(),i=this.width/e,n=0;n<e;n++)t[n].fillStyle(16777215).setSize(i*this.value,this.height).setTopLeftPosition(i*n,0);}});return i}(t.scene,10);t.once("destroy",(function(){e.destroy();})).addTransitionMode("blinds",{ease:"Linear",dir:"out",mask:e,onStart:function(t,e,i,n){t.setCurrentImageMaskEnable(!0,!0);},onProgress:function(t,e,i,n){t.maskGameObject.setValue(n);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1);}});},function(t){var e,i,n,s=(e=t.scene,i=Math.ceil(t.width/40),n=Math.ceil(t.height/40),new Xk(e,{type:"Graphics",create:{rectangle:i*n},update:function(){for(var t=this.getShapes(),e=this.width/i,s=this.height/n,r=0;r<n;r++)for(var o=0;o<i;o++)t[o*n+r].fillStyle(16777215).setSize(e*this.value,s*this.value).setCenterPosition(e*(o+.5),s*(r+.5));}}));t.once("destroy",(function(){s.destroy();})).addTransitionMode("squares",{ease:"Linear",dir:"out",mask:s,onStart:function(t,e,i,n){t.setCurrentImageMaskEnable(!0,!0);},onProgress:function(t,e,i,n){t.maskGameObject.setValue(n);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1);}});},function(t){var e,i,n,s=(e=t.scene,i=Math.ceil(t.width/60),n=Math.ceil(t.height/60),new Xk(e,{type:"Graphics",create:{lines:i*n},update:function(){for(var t=this.getShapes(),e=this.width/(i-1),s=this.height/n,r=2*s,o=e*this.value,a=s*this.value,h=0;h<n;h++)for(var l=0;l<i;l++){var u=l*e,c=h*r+l%2*s;t[l*n+h].fillStyle(16777215).start(u+o,c).lineTo(u,c+a).lineTo(u-o,c).lineTo(u,c-a).lineTo(u+o,c).close();}}}));t.once("destroy",(function(){s.destroy();})).addTransitionMode("diamonds",{ease:"Linear",dir:"out",mask:s,onStart:function(t,e,i,n){t.setCurrentImageMaskEnable(!0,!0);},onProgress:function(t,e,i,n){t.maskGameObject.setValue(n);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1);}});},function(t){var e,i,n,s=(e=t.scene,i=Math.ceil(t.width/60),n=Math.ceil(t.height/60),new Xk(e,{type:"Graphics",create:{circle:i*n},update:function(){for(var t=this.getShapes(),e=this.width/(i-1),s=this.height/n,r=2*s,o=Math.max(e,s)*this.value,a=0;a<n;a++)for(var h=0;h<i;h++){var l=h*e,u=a*r+h%2*s;t[h*n+a].fillStyle(16777215).setCenterPosition(l,u).setRadius(o);}}}));t.once("destroy",(function(){s.destroy();})).addTransitionMode("circles",{ease:"Linear",dir:"out",mask:s,onStart:function(t,e,i,n){t.setCurrentImageMaskEnable(!0,!0);},onProgress:function(t,e,i,n){t.maskGameObject.setValue(n);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1);}});},function(t){var e=function(t,e){var i=new Xk(t,{type:"Graphics",create:{lines:e},update:function(){for(var t=this.getShapes(),i=this.width/e,n=i/2,s=0;s<e;s++){var r=i*s,o=this.height*this.value,a=r+n;t[s].fillStyle(16777215).start(r,0).horizontalLineTo(o).arc(a,o,n,180,0,!0).horizontalLineTo(-o).lineTo(r,0).close();}}});return i}(t.scene,10);t.once("destroy",(function(){e.destroy();})).addTransitionMode("curtain",{ease:"Linear",dir:"out",mask:e,onStart:function(t,e,i,n){i.tint=0,t.setCurrentImageMaskEnable(!0,!0),t.setNextImageMaskEnable(!0,!0);},onProgress:function(t,e,i,n){var s;n<.5?(n=ha(n),s=Math.floor(255*(1-n)),t.maskGameObject.setValue(n),e.tint=(s<<16)+(s<<8)+s):(e.visible&&t.setChildVisible(e,!1),n=ha(n),s=Math.floor(255*(1-n)),t.maskGameObject.setValue(n),i.tint=(s<<16)+(s<<8)+s);},onComplete:function(t,e,i,n){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215;}});},function(t){t.addTransitionMode("pixellate",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,n){t.setChildVisible(i,!1),e.effect=e.preFX.addPixelate(0),i.effect=i.preFX.addPixelate(0);},onProgress:function(t,e,i,n){if(n<.5){n=ha(n);var s=Math.min(e.width,e.height)/5;e.effect.amount=Math.ceil(s*n);}else {e.visible&&t.setChildVisible(e,!1),i.visible||t.setChildVisible(i,!0),n=ha(n);s=Math.min(i.width,i.height)/5;i.effect.amount=Math.ceil(s*n);}},onComplete:function(t,e,i,n){e.preFX.remove(e.effect),delete e.effect,t.setChildVisible(e,!0),i.preFX.remove(i.effect),delete i.effect;}});},function(t){var e,i,n;e=t.scene.game,i="rexDissolvePostFx",n=xb,U(e).renderer.pipelines.addPostPipeline(i,n),t.addTransitionMode("dissolve",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,n){e.effect=function(t,e,i){void 0===i&&(i={}),t.setPostPipeline(e);var n=t.postPipelines[t.postPipelines.length-1];return n.resetFromJSON(i),i.name&&(n.name=i.name),n}(e,xb);},onProgress:function(t,e,i,n){e.effect.setProgress(n);},onComplete:function(t,e,i,n){!function(t,e,i){if(void 0===i)for(var n=(s=t.postPipelines).length-1;n>=0;n--)(o=s[n])instanceof e&&(o.destroy(),wb(s,n));else {n=0;for(var s,r=(s=t.postPipelines).length;n<r;n++){var o;(o=s[n])instanceof e&&o.name===i&&(o.destroy(),wb(s,n));}}}(e,xb),delete e.effect;}});},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,n){i.effect=i.preFX.addReveal(Sb,0,0);},onProgress:function(t,e,i,n){i.effect.progress=n;},onComplete:function(t,e,i,n){i.preFX.remove(i.effect),delete i.effect;}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,n){i.effect=i.preFX.addReveal(Sb,1,0);},onProgress:function(t,e,i,n){i.effect.progress=n;},onComplete:function(t,e,i,n){i.preFX.remove(i.effect),delete i.effect;}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,n){i.effect=i.preFX.addReveal(Sb,0,1);},onProgress:function(t,e,i,n){i.effect.progress=n;},onComplete:function(t,e,i,n){i.preFX.remove(i.effect),delete i.effect;}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,n){i.effect=i.preFX.addReveal(Sb,1,1);},onProgress:function(t,e,i,n){i.effect.progress=n;},onComplete:function(t,e,i,n){i.preFX.remove(i.effect),delete i.effect;}});}],Tb=function(e){function i(e,n,s,r,o,a){var l;h(this,i),l=t(this,i,[e,n,s,r,o,a]);for(var u=0,c=Pb.length;u<c;u++)Pb[u](v(l));return l}return d(i,e),u(i)}(vb);E.register("transitionImagePack",(function(t,e,i,n,s){var r=new Tb(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.TransitionImagePack",Tb);var Ob={scaleImage:function(){var t=this.image,e=Ym(t,{width:this.width,height:this.height},this.scaleUp,!0);return t.setDisplaySize(e.width,e.height),this.resetChildScaleState(t),this}};Object.assign(Ob,ab);var Mb=function(){var t=this.background;return t?(t.setOrigin(this.originX,this.originY),t.setPosition(this.x,this.y),uv(t,this.displayWidth,this.displayHeight),this.resetChildScaleState(t),this):this},Eb=Phaser.Utils.Objects.IsPlainObject,_b=Phaser.Utils.Objects.GetValue,Rb=function(e){function i(e,n,s,r,o,a){var l;h(this,i),Eb(n)?(n=_b(a=n,"x",0),s=_b(a,"y",0),r=_b(a,"key",void 0),o=_b(a,"frame",void 0)):Eb(o)&&(a=o,o=void 0);var u=_b(a,"image");u?u.setPosition(n,s).setOrigin(.5):(u=e.add.image(n,s,r,o),void 0===r&&u.setVisible(!1)),(l=t(this,i,[e,n,s,1,1])).type="rexImageBox";var c=_b(a,"background");c&&l.add(c),l.background=c,l.add(u),l.image=u,l.scaleUp=_b(a,"scaleUp",!1);var d=_b(a,"width",u.width),f=_b(a,"height",u.height);return l.resize(d,f),l}return d(i,e),u(i,[{key:"texture",get:function(){return this.image.texture}},{key:"frame",get:function(){return this.image.frame}},{key:"flipX",get:function(){return this._flipX},set:function(t){this._flipX!==t&&(this._flipX=t,this.image.setFlipX(t));}},{key:"flipY",get:function(){return this._flipY},set:function(t){this._flipY!==t&&(this._flipY=t,this.image.setFlipY(t));}},{key:"resize",value:function(t,e){return m(f(i.prototype),"resize",this).call(this,t,e),Mb.call(this),this.scaleImage(),this}},{key:"setTexture",value:function(t,e){var i=this.image;return i.setTexture(t,e),null!==t?(this.setChildVisible(i,!0),this.scaleImage()):this.setChildVisible(i,!1),this}}]),i}(ip);Object.assign(Rb.prototype,Ob),E.register("imageBox",(function(t,e,i,n,s){var r=new Rb(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.ImageBox",Rb),E.register("fullWindowRectangle",(function(t,e){var i=new Pg(this.scene,t,e);return this.scene.add.existing(i),i})),Q(window,"RexPlugins.UI.FullWindowRectangle",Pg),E.register("cover",(function(t){var e=new _g(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Cover",_g);var Lb=function(t,e){if(this.scene.sys.scale.autoRound&&(t=Math.floor(t),e=Math.floor(e)),this.width===t&&this.height===e)return this;var i=this.node.style;return i.width="".concat(t,"px"),i.height="".concat(e,"px"),this.updateSize(),this},Bb={id:["id",void 0],text:["value",void 0],maxLength:["maxLength",void 0],minLength:["minLength",void 0],placeholder:["placeholder",void 0],tooltip:["title",void 0],readOnly:["readOnly",!1],spellCheck:["spellcheck",!1],autoComplete:["autocomplete","off"]},Db={align:["textAlign",void 0],paddingLeft:["padding-left",void 0],paddingRight:["padding-right",void 0],paddingTop:["padding-top",void 0],paddingBottom:["padding-bottom",void 0],fontFamily:["fontFamily",void 0],fontSize:["font-size",void 0],color:["color","#ffffff"],backgroundColor:["backgroundColor","transparent"],border:["border",0],borderColor:["borderColor","transparent"],outline:["outline","none"],direction:["direction",void 0]},Ib={input:"textchange",click:"click",dblclick:"dblclick",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",keydown:"keydown",keyup:"keyup",keypress:"keypress",compositionstart:"compositionStart",compositionend:"compositionEnd",compositionupdate:"compositionUpdate",focus:"focus",blur:"blur",select:"select"},jb=Phaser.Utils.Objects.GetValue,zb=function(t,e,i,n){var s=jb(n,"preventDefault",!1),r=jb(n,"preTest"),o=function(n){e.addEventListener(n,(function(e){r&&!r(t,n)||t.emit(i[n],t,e),s&&e.preventDefault();}));};for(var a in i)o(a);},Ab=Phaser.GameObjects.DOMElement,Fb=Phaser.Utils.Objects.IsPlainObject,Wb=Phaser.Utils.Objects.GetValue,Vb=function(e){function i(e,n,s,r,o,a){var l,u;h(this,i),Fb(n)?(n=Wb(a=n,"x",0),s=Wb(a,"y",0),r=Wb(a,"width",0),o=Wb(a,"height",0)):Fb(r)&&(r=Wb(a=r,"width",0),o=Wb(a,"height",0)),void 0===a&&(a={});var c=Wb(a,"inputType",void 0);void 0===c&&(c=Wb(a,"type","text")),"textarea"===c?(u=document.createElement("textarea")).style.resize="none":(u=document.createElement("input")).type=c,Rl(Bb,a,u);var d=Wb(a,"style",void 0);d=Rl(Db,a,d);var f=u.style;for(var p in a)p in Bb||p in Db||p in f&&(d[p]=a[p]);return d["box-sizing"]="border-box",(l=t(this,i,[e,n,s,u,d])).type="rexInputText",l.resize(r,o),zb(v(l),u,Ib),Ll(u),Wb(a,"selectAll",!1)&&l.selectAll(),l._isFocused=!1,l.on("focus",(function(){this._isFocused=!0;}),v(l)).on("blur",(function(){this._isFocused=!1;}),v(l)),l}return d(i,e),u(i,[{key:"inputType",get:function(){return "textarea"===this.node.tagName.toLowerCase()?"textarea":this.node.type}},{key:"text",get:function(){return this.node.value},set:function(t){this.node.value=t;}},{key:"setText",value:function(t){return this.text=t,this}},{key:"maxLength",get:function(){return this.node.maxLength},set:function(t){this.node.maxLength=t;}},{key:"setMaxLength",value:function(t){return this.maxLength=t,this}},{key:"minLength",get:function(){return this.node.minLength},set:function(t){this.node.minLength=t;}},{key:"setMinLength",value:function(t){return this.minLength=t,this}},{key:"placeholder",get:function(){return this.node.placeholder},set:function(t){this.node.placeholder=t;}},{key:"setPlaceholder",value:function(t){return this.placeholder=t,this}},{key:"selectText",value:function(t,e){return void 0===t?this.node.select():this.node.setSelectionRange(t,e),this}},{key:"selectAll",value:function(){return this.selectText(),this}},{key:"selectionStart",get:function(){return this.node.selectionStart}},{key:"selectionEnd",get:function(){return this.node.selectionEnd}},{key:"selectedText",get:function(){var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}},{key:"cursorPosition",get:function(){return this.node.selectionStart},set:function(t){this.node.setSelectionRange(t,t);}},{key:"setCursorPosition",value:function(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}},{key:"tooltip",get:function(){return this.node.title},set:function(t){this.node.title=t;}},{key:"setTooltip",value:function(t){return this.tooltip=t,this}},{key:"setTextChangedCallback",value:function(t){return this.onTextChanged=t,this}},{key:"readOnly",get:function(){return this.node.readOnly},set:function(t){this.node.readOnly=t;}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}},{key:"spellCheck",get:function(){return this.node.spellcheck},set:function(t){this.node.spellcheck=t;}},{key:"setSpellCheck",value:function(t){return this.spellCheck=t,this}},{key:"fontColor",get:function(){return this.node.style.color},set:function(t){this.node.style.color=t;}},{key:"setFontColor",value:function(t){return this.fontColor=t,this}},{key:"setStyle",value:function(t,e){return this.node.style[t]=e,this}},{key:"getStyle",value:function(t){return this.node.style[t]}},{key:"scrollToBottom",value:function(){return this.node.scrollTop=this.node.scrollHeight,this}},{key:"setEnabled",value:function(t){return void 0===t&&(t=!0),this.node.disabled=!t,this}},{key:"setBlur",value:function(){return this.node.blur(),this}},{key:"setFocus",value:function(){return this.node.focus(),this}},{key:"isFocused",get:function(){return this._isFocused}}]),i}(Ab),Yb={resize:Lb};Object.assign(Vb.prototype,Yb),E.register("inputText",(function(t){var e=new Vb(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.InputText",Vb);var Gb=Phaser.Utils.Objects.GetValue,Xb=function(t,e){return void 0===t&&(t=0),new Promise((function(i,n){setTimeout((function(){i(e);}),t);}))},Hb=function(t){var e=t.game,i=t.fileInput,n=t.closeDelay;return Ih(U(e).events,"focus").then((function(){return Xb(n)})).then((function(){var t={files:i.files};return Promise.resolve(t)}))},Ub=Phaser.Utils.Objects.GetValue,Nb=Phaser.DOM.RemoveFromDOM,Kb=function(t,e){var i=Ub(e,"closeDelay",200),n=function(t,e){var i=document.createElement("input");i.type="file";var n=Gb(e,"accept",""),s=Gb(e,"multiple",!1);return i.setAttribute("accept",n),s?i.setAttribute("multiple",""):i.removeAttribute("multiple"),i}(0,e);return n.click(),Hb({game:t,fileInput:n,closeDelay:i}).then((function(t){return Nb(n),n.remove(),Promise.resolve(t)}))},Jb=function(t){return this.setOrigin(t.originX,t.originY),this.setPosition(t.x,t.y),this.resize(t.displayWidth,t.displayHeight),this},qb=function(t,e,i,n,s,r){if(null===s||!1===s);else if(Gg(s))s();else {var o=function(t,e,i){if(void 0===i)switch(e){case"image":case"svg":i="textures";break;case"animation":i="json";break;case"tilemapTiledJSON":case"tilemapCSV":i="tilemap";break;case"glsl":i="shader";break;default:i=e;}return t=U(t),"textures"===i?t.textures:t.cache[i]}(t,i,s);o.exists(n)&&o.remove(n);}var a=t.load;if(r&&a.once("filecomplete-".concat(i,"-").concat(n),(function(t,e,i){r(i);})),Gg(e))e();else {var h=window.URL.createObjectURL(e);a[i](n,h);}a.start();},Zb={loadFile:function(t,e,i,n,s){var r=this.scene;return qb(r,t,e,i,n,s),this},loadFilePromise:function(t,e,i,n){var s=this.scene;return new Promise((function(r,o){qb(s,t,e,i,n,(function(t){r(t);}));}))}},$b=Phaser.GameObjects.DOMElement,Qb=Phaser.Utils.Objects.IsPlainObject,tx=Phaser.Utils.Objects.GetValue,ex=function(e){function i(e,n,s,r,o,a){var l;h(this,i),Qb(n)?(n=tx(a=n,"x",0),s=tx(a,"y",0),r=tx(a,"width",0),o=tx(a,"height",0)):Qb(r)&&(r=tx(a=r,"width",0),o=tx(a,"height",0));var u=document.createElement("input");u.type="file",u.style.display="none";var c=document.createElement("label");c.appendChild(u);var d=tx(a,"style",void 0);(l=t(this,i,[e,n,s,c,d])).type="rexFileChooser",l.resetFromJSON(a),l.resize(r,o);var f=v(l);return u.onchange=function(){f.emit("change",f);},l.setCloseDelay(tx(a,"closeDelay",200)),u.onclick=function(){Hb({game:e,fileInput:u,closeDelay:f.closeDelay}).then((function(){f.emit("select",f);}));},l}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.setAccept(tx(t,"accept","")),this.setMultiple(tx(t,"multiple",!1)),this}},{key:"setAccept",value:function(t){return void 0===t&&(t=""),this.fileInput.setAttribute("accept",t),this}},{key:"setMultiple",value:function(t){return void 0===t&&(t=!0),t?this.fileInput.setAttribute("multiple",""):this.fileInput.removeAttribute("multiple"),this}},{key:"setCloseDelay",value:function(t){return void 0===t&&(t=200),this.closeDelay=t,this}},{key:"fileInput",get:function(){return this.node.children[0]}},{key:"open",value:function(){return this.fileInput.click(),this}},{key:"files",get:function(){return this.fileInput.files}},{key:"setOpenEnable",value:function(t){return void 0===t&&(t=!0),this.fileInput.disabled=!t,this}}]),i}($b),ix={resize:Lb,syncTo:Jb};Object.assign(ex.prototype,ix,Zb),E.register("fileChooser",(function(t){var e=new ex(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.FileChooser",ex);var nx={setDropEnable:function(t){return void 0===t&&(t=!0),this.dropEnable=t,this},toggleDropEnable:function(){return this.dropEnable=!this.dropEnable,this}},sx={resize:Lb,syncTo:Jb};Object.assign(sx,nx,{addFilter:function(t,e){return this.filters||(this.filters={}),this.filters[t]=e,this},addFilters:function(t){for(var e in this.filters||(this.filters={}),t)this.filters[e]=t[e];return this}},Zb);var rx={dragenter:"dragenter",dragleave:"dragleave",dragover:"dragover",drop:"drop"},ox=Phaser.GameObjects.DOMElement,ax=Phaser.Utils.Objects.IsPlainObject,hx=Phaser.Utils.Objects.GetValue,lx=function(e){function i(e,n,s,r,o,a){var l;h(this,i),ax(n)?(n=hx(a=n,"x",0),s=hx(a,"y",0),r=hx(a,"width",0),o=hx(a,"height",0)):ax(r)&&(r=hx(a=r,"width",0),o=hx(a,"height",0)),void 0===a&&(a={});var u=document.createElement("div");(l=t(this,i,[e,n,s,u,hx(a,"style",void 0)])).type="rexFileDropZone",l.resize(r,o),l._files=[],l.setDropEnable(hx(a,"dropEnable",!0));var c=hx(a,"filters");return c&&l.addFilters(c),zb(v(l),u,rx,{preventDefault:!0,preTest:function(t){return t.dropEnable}}),l.on("drop",(function(t,e){this._files=e.dataTransfer.files;var i=this._files;if(i&&this.filters)for(var n in this.filters){for(var s=this.filters[n],r=[],o=0,a=i.length;o<a;o++){var h=i[o];s(h,i)&&r.push(h);}r.length>0&&this.emit("drop.".concat(n),r);}}),v(l)),l}return d(i,e),u(i,[{key:"files",get:function(){return this._files}}]),i}(ox);Object.assign(lx.prototype,sx),E.register("fileDropZone",(function(t){var e=new lx(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.FileDropZone",lx);var ux=Phaser.Math.Wrap,cx=function(t,e){if(this.hasRatioFitChild){var i,n,s;0===this.orientation?i=e-this.getInnerPadding("top")-this.getInnerPadding("bottom"):(this.getInnerPadding("left"),this.getInnerPadding("right"));for(var r=this.sizerChildren,o=0,a=r.length;o<a;o++){var h,l;if(!(l=(h=r[o]).rexSizer).hidden){var u=l.fitRatio;u&&(0===this.orientation?n=(s=i-this.getChildOuterPadding(h,"top")-this.getChildOuterPadding(h,"bottom"))*u:s=(n=i-this.getChildOuterPadding(h,"top")-this.getChildOuterPadding(h,"bottom"))/u,uv(h,n,s),h.isRexSizer&&h.setMinSize(n,s),l.resolved=!0);}}}},dx=function(e){function i(e){var n;return h(this,i),(n=t(this,i,[e,0,0,1,1])).isRexSpace=!0,n}return d(i,e),u(i)}(Phaser.GameObjects.Zone),fx=function(t,e){var i=this.sizerChildren;if(0===i.length)return -1;for(var n=-1,s=1/0,r=0,o=i.length;r<o;r++){var a=i[r];s>(h=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(s=h,n=r);}var h;a=i[i.length-1];return s>(h=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(s=h,n=r+1),n},px=Phaser.Utils.Objects.IsPlainObject,vx=Phaser.Utils.Objects.GetValue,gx=Phaser.Display.Align.CENTER,yx={min:0,full:-1},mx=function(t,e,i,n,s,r,a,h,l,u){zp.call(this,t);var c=t.isRexSpace,d=o(e);if(null===e)return this;if("number"===d);else if("string"===d)e=yx[e];else if(px(e)){var f;e=vx(f=e,"proportion",void 0),i=vx(f,"align",gx),n=vx(f,"padding",0),s=vx(f,"expand",!1),r=vx(f,"key",void 0),a=vx(f,"index",void 0),t.isRexSizer||(h=vx(f,"minWidth",void 0),l=vx(f,"minHeight",void 0)),u=vx(f,"fitRatio",0);}return "string"==typeof i&&(i=rp[i]),void 0===e&&(e=c?1:0),void 0===i&&(i=gx),void 0===n&&(n=0),void 0===s&&(s=!1),void 0===h&&(c?h=0:t.isRexSizer||(h=t._minWidth)),void 0===l&&(c?l=0:t.isRexSizer||(l=t._minHeight)),void 0===u||!1===u?u=0:!0===u&&(u=Vr(t)/Yr(t)),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=Ip(n),f.expand=s,f.fitRatio=0===e?u:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Vr(t):h:t.minHeight=void 0===l?Yr(t):l),s&&(0===this.orientation?t.minHeight=l:t.minWidth=h)),void 0!==r&&this.addChildrenMap(r,t),this},kx={add:mx,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),mx.call(this,new dx(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,s,r,o,a){return px(i)&&(i.index=t),mx.call(this,e,i,n,s,r,o,t,a),this},insertAtPosition:function(t,e,i,n,s,r,o,a,h){var l=fx.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,s,r,o,a,h),this}},bx=Phaser.Utils.Array.Remove,xx={remove:function(t,e){return this.getParentSizer(t)!==this||(bx(this.sizerChildren,t),Xp.call(this,t,e)),this},removeAll:function(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,Qm.call(this,t),this}},Cx={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=rp[e]),this.getSizerConfig(t).align=e,this}},wx={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,s,r,o=0,a=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=this.space.item,u=!0,c=0,d=a.length;c<d;c++)(e=a[c]).hasOwnProperty("rexSizer")&&((i=e.rexSizer).hidden||(0===(n=i.proportion)||t?(r=this.getChildWidth(e),i.fitRatio>0&&!i.resolved&&(r=void 0),void 0===r&&(0===n||this.hasProportion0Child?h=!0:r=0)):r=0,h||(r+=(s=e.rexSizer.padding).left+s.right,u?u=!1:r+=l,o+=r)));else for(c=0,d=a.length;c<d;c++)(e=a[c]).hasOwnProperty("rexSizer")&&((i=e.rexSizer).hidden||(void 0===(r=this.getChildWidth(e))&&(h=!0),h||(r+=(s=i.padding).left+s.right,o=Math.max(r,o))));return h?void 0:o+this.space.left+this.space.right},getChildrenHeight:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,s,r,o=0,a=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=0,u=a.length;l<u;l++)(e=a[l]).hasOwnProperty("rexSizer")&&((i=e.rexSizer).hidden||(void 0===(r=this.getChildHeight(e))&&(h=!0),h||(r+=(s=i.padding).top+s.bottom,o=Math.max(r,o))));else {var c=this.space.item,d=!0;for(l=0,u=a.length;l<u;l++)(e=a[l]).hasOwnProperty("rexSizer")&&((i=e.rexSizer).hidden||(0===(n=i.proportion)||t?(r=this.getChildHeight(e),i.fitRatio>0&&!i.resolved&&(r=void 0),void 0===r&&(0===n||this.hasProportion0Child?h=!0:r=0)):r=0,h||(r+=(s=i.padding).top+s.bottom,d?d=!1:r+=c,o+=r)));}return h?void 0:o+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer;if(0===this.orientation)n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);else if(n.expand){var s=this.space,r=e-s.left-s.right,o=n.padding;i=r-o.left-o.right;}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer;if(0===this.orientation){if(n.expand){var s=this.space,r=e-s.top-s.bottom,o=n.padding;i=r-o.top-o.bottom;}}else n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n<s;n++)(e=i[n]).isRexSizer&&t.push(e);return t},preLayout:function(){var t,e;this.hasRatioFitChild=!1;for(var i=this.sizerChildren,n=0,s=i.length;n<s;n++)(e=(t=i[n]).rexSizer).hidden||e.fitRatio>0&&(uv(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,sv.call(this),this},layoutChildren:function(){for(var t,e,i,n,s,r,o,a,h,l,u=this.sizerChildren,c=this.innerLeft,d=this.innerTop,f=this.innerWidth,p=this.innerHeight,v=c,g=d,y=this.startChildIndex,m=0,k=u.length;m<k;m++)l=0===y?m:ux(m+y,0,k),this.rtl&&(l=k-l-1),(t=u[l]).rexSizer.hidden||(i=(e=t.rexSizer).padding,$g.call(this,t),t.isRexSpace?(a=0,h=0):(a=this.getExpandedChildWidth(t),h=this.getExpandedChildHeight(t)),t.isRexSizer?(t.runLayout(this,a,h),Xm(t,this)):uv(t,a,h),void 0===a&&(a=Vr(t)),void 0===h&&(h=Yr(t)),0===this.orientation?(n=v+i.left,r=0===e.proportion||0===this.proportionLength?a:e.proportion*this.proportionLength,s=g+i.top,o=p-i.top-i.bottom):(n=v+i.left,r=f-i.left-i.right,s=g+i.top,o=0===e.proportion||0===this.proportionLength?h:e.proportion*this.proportionLength),Qg.call(this,t,n,s,r,o,e.align),0===this.orientation?v+=r+i.left+i.right+this.space.item:g+=o+i.top+i.bottom+this.space.item);},resolveWidth:function(t){if(void 0!==(t=Zp.call(this,t))&&0===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenWidth;e>0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){if(void 0!==(t=tv.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},hasWidthWrap:function(){return !(!this.hasRatioFitChild||1!==this.orientation)||$p.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&cx.call(this,t,void 0),Qp.call(this,t));},hasHeightWrap:function(){return !(!this.hasRatioFitChild||0!==this.orientation)||ev.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&cx.call(this,void 0,t),iv.call(this,t));},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],n=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?n||this.insertSpace(0):n&&this.remove(i,!0);var s=e.length-1,r=e[s],o=r&&r.isRexSpace;return "center"===t?o||this.insertSpace(s+1):o&&this.remove(r,!0),this}};Object.assign(wx,kx,xx,Cx,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var Sx=function(){for(var t,e,i=0,n=this.sizerChildren,s=0,r=n.length;s<r;s++)(t=n[s]).rexSizer.hidden||((e=t.rexSizer.proportion)>0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Px={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Tx=function(t){return "string"==typeof t&&(t=Px[t]),t},Ox=Phaser.Utils.Objects.IsPlainObject,Mx=Phaser.Utils.Objects.GetValue,Ex=function(e){function i(e,n,s,r,o,a,l){var u;return h(this,i),Ox(n)?(n=Mx(l=n,"x",0),s=Mx(l,"y",0),r=Mx(l,"width",void 0),o=Mx(l,"height",void 0),a=Mx(l,"orientation",0)):Ox(r)?(r=Mx(l=r,"width",void 0),o=Mx(l,"height",void 0),a=Mx(l,"orientation",0)):Ox(a)&&(a=Mx(l=a,"orientation",0)),void 0===a&&(a=0),(u=t(this,i,[e,n,s,r,o,l])).type="rexSizer",u.sizerChildren=[],u.setOrientation(a),u.setItemSpacing(Mx(l,"space.item",0)),u.setStartChildIndex(Mx(l,"startChildIndex",0)),u.setRTL(Mx(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return d(i,e),u(i,[{key:"setOrientation",value:function(t){return this.orientation=Tx(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=Sx.call(this)),this._childrenProportion}}]),i}(Vm);Object.assign(Ex.prototype,wx);var _x=function(t,e,i){if(t){var n=null==e,s=null==i;return n&&s||(n||(t.displayWidth=e),s||(t.displayHeight=i),n&&(t.scaleX=t.scaleY),s&&(t.scaleY=t.scaleX)),t}},Rx={appendText:Wi,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var n=t.iconSize;n&&(this.setChildDisplaySize(i,n,n),void 0!==this.iconWidth&&this.setIconSize(n)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame);}var s=this.childrenMap.action;if(s){t.action?this.show(s):this.hide(s);var r=t.actionSize;r&&(this.setChildDisplaySize(s,r,r),void 0!==this.actionWidth&&this.setActionSize(r)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame);}return this}},Lx=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"text",get:function(){var t=this.childrenMap.text;return t?t.text:""},set:function(t){var e=this.childrenMap.text;e&&e.setText(t);}},{key:"setText",value:function(t){return this.text=t,this}},{key:"setIconTexture",value:function(t,e){var i=this.childrenMap.icon;return i?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(_x(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}},{key:"setTexture",value:function(t,e){return this.setIconTexture(t,e),this}},{key:"setIconSize",value:function(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}},{key:"texture",get:function(){var t=this.childrenMap.icon;if(t)return t.texture}},{key:"frame",get:function(){var t=this.childrenMap.icon;if(t)return t.frame}},{key:"setActionTexture",value:function(t,e){var i=this.childrenMap.action;return void 0===i||(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(_x(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i))),this}},{key:"actionTexture",get:function(){var t=this.childrenMap.action;if(t)return t.texture}},{key:"actionFrame",get:function(){var t=this.childrenMap.action;if(t)return t.frame}},{key:"setActionSize",value:function(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}},{key:"preLayout",value:function(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&_x(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&_x(e,this.actionWidth,this.actionHeight),m(f(i.prototype),"preLayout",this).call(this);}},{key:"postLayout",value:function(t,e,i){var n=this.childrenMap.iconMask;n&&(n.setPosition(),this.resetChildPositionState(n));var s=this.childrenMap.actionMask;return s&&(s.setPosition(),this.resetChildPositionState(s)),this}},{key:"resize",value:function(t,e){m(f(i.prototype),"resize",this).call(this,t,e);var n=this.childrenMap.iconMask;n&&n.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}]),i}(Ex);Object.assign(Lx.prototype,Rx);var Bx=function(t,e,i,n){var s=new $k(e,i,n);if(t&&!t.isRexSizer){var r=s.createGeometryMask();t.setMask(r),this.once("destroy",(function(){t.setMask(),r.destroy();}));}return this.pin(s),s},Dx=Phaser.Utils.Objects.GetValue,Ix=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).type="rexLabel";var r=Dx(n,"background",void 0),o=Dx(n,"icon",void 0),a=Dx(n,"iconMask",void 0),l=Dx(n,"text",void 0),u=Dx(n,"action",void 0),c=Dx(n,"actionMask",void 0),d=Dx(n,"align",void 0);if(r&&s.addBackground(r),o){0===s.orientation?(l||u)&&(x={right:Dx(n,"space.icon",0),top:Dx(n,"space.iconTop",0),bottom:Dx(n,"space.iconBottom",0),left:Dx(n,"space.iconLeft",0)}):(l||u)&&(x={bottom:Dx(n,"space.icon",0),left:Dx(n,"space.iconLeft",0),right:Dx(n,"space.iconRight",0),top:Dx(n,"space.iconTop",0)});var f=Dx(n,"squareFitIcon",!1)?1:0;if(s.add(o,{proportion:0,padding:x,fitRatio:f}),a&&(a=Bx.call(v(s),o,o,1)),!f){var p=Dx(n,"iconSize",void 0);s.setIconSize(Dx(n,"iconWidth",p),Dx(n,"iconHeight",p));}}if(l){var g,y,m=Dx(n,"space.text",0),k=Dx(n,"expandTextWidth",!1),b=Dx(n,"expandTextHeight",!1);0===s.orientation?(g=k?1:0,u&&(x={right:m}),y=b):(g=b?1:0,u&&(x={bottom:m}),y=k),s.add(l,{proportion:g,expand:y,padding:x});}if(u){var x;x=0===s.orientation?{top:Dx(n,"space.actionTop",0),bottom:Dx(n,"space.actionBottom",0),right:Dx(n,"space.actionRight",0)}:{left:Dx(n,"space.actionLeft",0),right:Dx(n,"space.actionRight",0),bottom:Dx(n,"space.actionBottom",0)};f=Dx(n,"squareFitAction",!1)?1:0;if(s.add(u,{proportion:0,padding:x,fitRatio:f}),c&&(c=Bx.call(v(s),u,u,1)),!f){var C=Dx(n,"actionSize");s.setActionSize(Dx(n,"actionWidth",C),Dx(n,"actionHeight",C));}}return s.setChildrenAlignMode(d),s.addChildrenMap("background",r),s.addChildrenMap("icon",o),s.addChildrenMap("iconMask",a),s.addChildrenMap("text",l),s.addChildrenMap("action",u),s.addChildrenMap("actionMask",c),s}return d(i,e),u(i)}(Lx),jx=Phaser.Utils.Objects.GetValue,zx=function(t,e){var i=jx(e,"canvas"),n=jx(i,"width",128),s=jx(i,"height",128),r=new Yc(t,0,0,n,s);t.add.existing(r);var o=jx(i,"key"),a=jx(i,"frame"),h=jx(i,"fill");return void 0!==h?r.fill(h):void 0!==o&&r.loadTexture(o,a),r.setTexture=r.loadTexture.bind(r),r},Ax=Phaser.Utils.Objects.GetValue,Fx=function(t,e){var i=Ax(e,"clickTarget",this);return "string"==typeof i&&(i=t.getElement(i)),i},Wx=Phaser.Utils.Objects.GetValue,Vx={accept:"image/*",multiple:!1},Yx=function(t,e){if(0!==e.length){var i=t.childrenMap.icon,n=i.image,s=e[0];return n.loadFromFilePromise(s).then((function(){return i.scaleImage(),t.emit("select",s,t),Promise.resolve(s)}))}},Gx={openPromise:function(){var t,e=this;return (t=s().mark((function t(){var i;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=e,t.abrupt("return",Kb(e.scene.game,Vx).then((function(t){return Yx(i,t.files)})));case 2:case"end":return t.stop()}}),t)})),function(){var e=this,i=arguments;return new Promise((function(n,s){var r=t.apply(e,i);function o(t){a(r,n,s,o,h,"next",t);}function h(t){a(r,n,s,o,h,"throw",t);}o(void 0);}))})()},open:function(){return this.openPromise(),this},setClickOpenEnable:function(t){return void 0===t&&(t=!0),this.clickBehavior&&this.clickBehavior.setEnable(t),this.fileChooser&&this.fileChooser.setOpenEnable(t),this}},Xx={getFileName:function(t){if(!t)return null;var e=t.name;return e.substr(0,e.lastIndexOf("."))},saveTexture:function(t){return this.childrenMap.canvas.generateTexture(t),this}};Object.assign(Xx,Gx);var Hx=Phaser.Utils.Objects.GetValue,Ux=function(e){function i(e,n){var s;h(this,i);var r=function(t,e){var i=new Rb(t,{scaleUp:jx(e,"scaleUpIcon",!1),background:jx(e,"iconBackground"),image:zx(t,e)});return t.add.existing(i),i}(e,n);n.icon=r,(s=t(this,i,[e,n])).type="rexImageFileInputLabel";var o=s.iconWidth,a=s.iconWidth;return void 0!==o&&void 0!==a&&r.resize(o,a),s.clickTarget=Fx(v(s),n),s.clickTarget&&(Hx(n,"domButton",!0)?s.fileChooser=function(t,e){var i=t.scene,n=new ex(i,Vx);return i.add.existing(n),t.pin(n),n.on("change",(function(){Yx(t,n.files);})),n}(v(s)):s.clickBehavior=function(t,e){var i=Fx(t,e);if(i){var n=Wx(e,"click"),s=new wc(i,n);return s.on("click",t.open,t),s}}(v(s),n)),s.addChildrenMap("canvas",r.image),s.addChildrenMap("iconBackground",r.background),s.addChildrenMap("fileChooser",s.fileChooser),s}return d(i,e),u(i,[{key:"postLayout",value:function(){this.fileChooser&&(this.fileChooser.syncTo(this.clickTarget),this.resetChildState(this.fileChooser));}}]),i}(Ix);Object.assign(Ux.prototype,Xx),E.register("imageInputLabel",(function(t){var e=new Ux(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.ImageInputLabel",Ux);var Nx=function(e){function i(e,n){var s;return h(this,i),g(s=t(this,i,[e]),new Proxy(v(s),v(s)))}return d(i,e),u(i,[{key:"get",value:function(t,e){if(br(t,e))return t[e];var i=t.parent;return br(i,e)?i[e]:void 0}},{key:"set",value:function(t,e,i){return br(t,e)?t[e]=i:br(t.parent,e)&&(t.parent[e]=i),!0}},{key:"key",get:function(){return this.parent.texture.key},set:function(t){this.parent.setTexture(t,this.frame);}},{key:"frame",get:function(){return this.parent.frame.name},set:function(t){this.parent.setFrame(t);}},{key:"scale",get:function(){return this.parent.scaleX},set:function(t){this.parent.setScale(t);}}]),i}(mo),Kx=Phaser.Utils.Objects.GetValue,Jx=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).style=Kx(n,"style",v(s));var r=Kx(n,"propertiesMap");return s.activeStyle=qx(n,"active",r),s.hoverStyle=qx(n,"hover",r),s.disableStyle=qx(n,"disable",r),s.onModifyStyle=Kx(n,"onModifyStyle"),s}return d(i,e),u(i,[{key:"getStyle",value:function(t){return Zl(this.style,t)}},{key:"modifyStyle",value:function(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}},{key:"applyStyle",value:function(t){if(t){var e=this.getStyle(t);return $l(e,t)?void 0:(this.modifyStyle(t),e)}}},{key:"setActiveState",value:function(t){return Zx.call(this,"active",t),this}},{key:"setHoverState",value:function(t){return Zx.call(this,"hover",t),this}},{key:"setDisableState",value:function(t){return Zx.call(this,"disable",t),this}}]),i}(mo),qx=function(t,e,i){var n=ql(t,e);if(i)for(var s in n)i.hasOwnProperty(s)&&(n[i[s]]=n[s],delete n[s]);return n},Zx=function(t,e){void 0===e&&(e=!0);var i="".concat(t,"State"),n="".concat(t,"Style"),s="".concat(t,"StyleSave");this[i]!==e&&(this[i]=e,e?this[s]=this.applyStyle(this[n]):(this.applyStyle(this[s]),this[s]=void 0));},$x={addStyleManager:function(t){return this.styleManager=new Jx(this,t),this},setActiveState:function(t){return this.styleManager.setActiveState(t),this},setHoverState:function(t){return this.styleManager.setHoverState(t),this},setDisableState:function(t){return this.styleManager.setDisableState(t),this}},Qx=Phaser.GameObjects.Image,tC=Phaser.Utils.Objects.GetValue,eC=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),(s=t(this,i,[e,tC(n,"x",0),tC(n,"y",0),tC(n,"key",""),tC(n,"frame",void 0)])).type="rexStatesImage";var r=tC(n,"effects",!0);return r&&Pr(v(s),r),s.style=new Nx(v(s),n),n.style=s.style,s.addStyleManager(n),delete n.style,s}return d(i,e),u(i)}(Qx);Object.assign(eC.prototype,$x),E.register("statesImage",(function(t){var e=new eC(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.StatesImage",eC);var iC=function(e){function i(e,n){var s;return h(this,i),void 0===n&&(n={}),(s=t(this,i,[e,n])).type="rexStatesRoundRectangleShape",n.style=v(s),n.propertiesMap=nC,s.addStyleManager(n),delete n.style,delete n.propertiesMap,s}return d(i,e),u(i)}(ae),nC={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(iC.prototype,$x),E.register("statesRoundRectangle",(function(t){var e=new iC(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.StatesRoundRectangle",iC);var sC=function(e){function i(e,n){var s;return h(this,i),g(s=t(this,i,[e]),new Proxy(v(s),v(s)))}return d(i,e),u(i,[{key:"get",value:function(t,e){if(br(t,e))return t[e];var i=t.parent;return br(i,e)?i[e]:void 0}},{key:"set",value:function(t,e,i){return br(t,e)?t[e]=i:br(t.parent,e)&&(t.parent[e]=i),!0}},{key:"key",get:function(){return this.parent.texture.key},set:function(t){this.parent.setTexture(t,this.frame);}},{key:"frame",get:function(){return this.parent.frame.name},set:function(t){this.parent.setFrame(t);}},{key:"leftWidth",get:function(){return this.parent.leftWidth},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,t,e.rightWidth,e.topHeight,e.bottomHeight);}},{key:"rightWidth",get:function(){return this.parent.rightWidth},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,e.leftWidth,t,e.topHeight,e.bottomHeight);}},{key:"topHeight",get:function(){return this.parent.topHeight},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,e.leftWidth,e.rightWidth,t,e.bottomHeight);}},{key:"bottomHeight",get:function(){return this.parent.bottomHeight},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,e.leftWidth,e.rightWidth,e.topHeight,t);}}]),i}(mo),rC=Phaser.GameObjects.NineSlice,oC=Phaser.Utils.Objects.GetValue,aC=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),(s=t(this,i,[e,oC(n,"x",0),oC(n,"y",0),oC(n,"key",null),oC(n,"frame",null),oC(n,"width",0),oC(n,"height",0),oC(n,"leftWidth",0),oC(n,"rightWidth",0),oC(n,"topHeight",0),oC(n,"bottomHeight",0)])).type="rexStatesNineSlice";var r=oC(n,"effects",!0);return r&&Pr(v(s),r),s.style=new sC(v(s),n),n.style=s.style,s.addStyleManager(n),delete n.style,s}return d(i,e),u(i)}(rC);Object.assign(aC.prototype,$x),E.register("statesNineSlice",(function(t){var e=new aC(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.StatesNineSlice",aC);var hC=Phaser.GameObjects.Text,lC=Phaser.Utils.Objects.GetValue,uC=function(e){function i(e,n){var s;return h(this,i),void 0===n&&(n={}),(s=t(this,i,[e,lC(n,"x",0),lC(n,"y",0),lC(n,"text",""),n])).type="rexStatesText",n.style=s.style,n.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i);},s.addStyleManager(n),delete n.style,s}return d(i,e),u(i)}(hC);Object.assign(uC.prototype,$x),E.register("statesText",(function(t){var e=new uC(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.StatesText",uC);var cC=function(t,e){void 0===e&&(e={}),void 0===e.options&&(e.options={});var i=e.options;i.responsive=!1,i.maintainAspectRatio=!1,i.hasOwnProperty("devicePixelRatio")||(i.devicePixelRatio=1);var n=!1;void 0===i.animation?i.animation={}:!1===i.animation&&(n=!0,i.animation={});var s=i.animation;n&&(s.duration=0);var r=s.onProgress;s.onProgress=function(e){r&&r(e),t.needRedraw();};var o=s.onComplete;return s.onComplete=function(e){o&&o(e),t.needRedraw();},e},dC=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),(l=t(this,i,[e,n,s,r,o])).type="rexChart",l.chart=void 0,void 0!==a&&l.setChart(a),l}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&(this.chart&&(this.chart.destroy(),this.chart=void 0),m(f(i.prototype),"destroy",this).call(this,t));}},{key:"resize",value:function(t,e){if(t===this.width&&e===this.height)return this;if(m(f(i.prototype),"resize",this).call(this,t,e),this.chart){var n=this.chart;n.height=this.canvas.height,n.width=this.canvas.width,n.aspectRatio=n.height?n.width/n.height:null,n.update();}return this}}]),i}(Yc),fC={setChart:function(t){if(!window.Chart){return console.error("Can not find chartjs! Load chartjs in preload stage.\nscene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/Chart.min.js');"),this}return this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,cC(this,t)),this},getChartDataset:function(t){if(void 0!==this.chart){if("string"!=typeof t)return this.chart.data.datasets[t];for(var e,i=this.chart.data.datasets,n=0,s=i.length;n<s;n++)if((e=i[n]).label===t)return e}},getChartData:function(t,e){var i=this.getChartDataset(t);if(void 0!==i){if("string"==typeof e)if(-1===(e=this.chart.data.labels.indexOf(e)))return;return i.data[e]}},setChartData:function(t,e,i){if(void 0===this.chart)return this;var n=this.getChartDataset(t);if("string"==typeof e&&-1===(e=this.chart.data.labels.indexOf(e)))return this;return n.data[e]=i,this},updateChart:function(){return void 0===this.chart||this.chart.update(),this}};Object.assign(dC.prototype,fC),E.register("chart",(function(t,e,i,n,s){var r=new dC(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.Chart",dC),E.register("container",(function(t,e,i,n,s){var r=new ip(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.Container",ip),E.register("sizer",(function(t,e,i,n,s,r){var o=new Ex(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Q(window,"RexPlugins.UI.Sizer",Ex);var pC=function(){return Array.prototype.reduce.call(arguments,vC,0)},vC=function(t,e){return t+e},gC=Phaser.Utils.Objects.IsPlainObject,yC=Phaser.Utils.Objects.GetValue,mC=Phaser.Display.Align.CENTER,kC=function(t,e,i,n,s){if("number"==typeof t||"number"==typeof e)if(void 0===t){for(var r=0;r<n;r++)if(!i[o=e*n+r])return o}else if(void 0===e){for(r=0;r<s;r++)if(!i[o=r*n+t])return o}else {if(!i[o=e*n+t])return o}else if(!0===e){var o;for(r=0;r<n;r++)for(var a=0;a<s;a++)if(!i[o=a*n+r])return o}else {r=0;for(var h=i.length;r<h;r++)if(!i[r])return r}return null},bC={add:function(t,e,i,n,s,r,o){(zp.call(this,t),gC(e))&&(e=yC(a=e,"column",void 0),i=yC(a,"row",void 0),n=yC(a,"align",mC),s=yC(a,"padding",0),r=yC(a,"expand",!1),o=yC(a,"key",void 0));var a,h=kC(e,i,this.sizerChildren,this.columnCount,this.rowCount);if(null===h){if("number"==typeof e&&"number"==typeof i)return this;!0===i||"number"==typeof i?this.addEmptyColumn():this.addEmptyRow(),h=kC(e,i,this.sizerChildren,this.columnCount,this.rowCount);}return "string"==typeof n&&(n=rp[n]),void 0===n&&(n=mC),void 0===s&&(s=0),void 0===r&&(r=!0),(a=this.getSizerConfig(t)).align=n,a.padding=Ip(s),gC(r)?(a.expandWidth=yC(r,"width",!1),a.expandHeight=yC(r,"height",!1)):(a.expandWidth=r,a.expandHeight=r),this.sizerChildren[h]=t,void 0!==o&&this.addChildrenMap(o,t),this}},xC=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=t.length-1);for(var s=i;s<=n;s++)t[s]=e;return t},CC={remove:function(t,e){if(this.getParentSizer(t)!==this)return this;var i=this.sizerChildren.indexOf(t);return -1!==i&&(this.sizerChildren[i]=null),Xp.call(this,t,e),this},removeAt:function(t,e,i){var n=this.getChildAt(t,e);return n&&this.remove(n,i),this},removeAll:function(t){for(var e=this.sizerChildren.length-1;e>=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t);}return this},clear:function(t){return xC(this.sizerChildren,null),Qm.call(this,t),this}},wC={setColumnSpace:function(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)xC(this.space.column,t);else for(var e=0,i=this.columnCount-1;e<i;e++)this.space.column[e]=t[e]||0;return this},setRowSpace:function(t){if(this.space.row||(this.space.row=[]),this.space.row.length=this.rowCount-1,"number"==typeof t)xC(this.space.row,t);else for(var e=0,i=this.rowCount-1;e<i;e++)this.space.row[e]=t[e]||0;return this},setIndentLeft:function(t,e){return this.space.indentLeftOdd=t,this.space.indentLeftEven=e,this},setIndentTop:function(t,e){return this.space.indentTopOdd=t,this.space.indentTopEven=e,this}},SC=Phaser.Utils.Objects.GetValue,PC=function(t,e,i){void 0===e&&(e=this.rowProportions[0]||0),void 0===i&&(i=this.space.row[0]||0),this.rowCount+=1,this.gridCount+=this.columnCount;for(var n=[t*this.columnCount,0],s=0;s<this.columnCount;s++)n.push(null);return this.sizerChildren.splice.apply(this.sizerChildren,n),this.rowProportions.push(e),this.rowHeight.length+=1,this.space.row.splice(t,0,i),this},TC=function(t,e,i){void 0===e&&(e=this.columnProportions[0]||0),void 0===i&&(i=this.space.column[0]||0),this.columnCount+=1,this.gridCount+=this.rowCount;for(var n=this.rowCount-1;n>=0;n--){var s=n*this.columnCount+t;this.sizerChildren.splice(s,0,null);}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},OC={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,s,r,o=0,a=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l<this.columnCount;l++){if(e=0,0===(r=this.columnProportions[l])||t){for(var u=0;u<this.rowCount;u++)(i=a[u*this.columnCount+l])&&(i.rexSizer.hidden||(void 0===(s=this.getChildWidth(i))&&(0===r||this.hasColumnProportion0Child?h=!0:s=0),h||(s+=(n=i.rexSizer.padding).left+n.right,e=Math.max(e,s))));h||(o+=e);}h||t&&(this.columnWidth[l]=e);}if(!h){var c=this.space,d=Math.max(c.indentLeftOdd,c.indentLeftEven);return o+pC.apply(void 0,[c.left,d].concat(w(c.column),[c.right]))}},getChildrenHeight:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,s,r,o=0,a=this.sizerChildren,h=!1;this.totalRowProportions;for(var l=0;l<this.rowCount;l++){if(e=0,0===(r=this.rowProportions[l])||t){for(var u=0;u<this.columnCount;u++)(i=a[l*this.columnCount+u])&&(i.rexSizer.hidden||(void 0===(s=this.getChildHeight(i))&&(0===r||this.hasRowProportion0Child?h=!0:s=0),h||(s+=(n=i.rexSizer.padding).top+n.bottom,e=Math.max(e,s))));h||(o+=e);}h||t&&(this.rowHeight[l]=e);}if(!h){var c=this.space,d=Math.max(c.indentTopOdd,c.indentTopEven);return o+pC.apply(void 0,[c.top,d].concat(w(c.row),[c.bottom]))}},getExpandedChildWidth:function(t,e){var i,n=t.rexSizer;if(n.expandWidth){var s=n.padding;i=e-s.left-s.right;}return i},getExpandedChildHeight:function(t,e){var i,n=t.rexSizer;if(n.expandHeight){var s=n.padding;i=e-s.top-s.bottom;}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n<s;n++)(e=i[n])&&e.isRexSizer&&t.push(e);return t},preLayout:function(){return this._totalColumnProportions=void 0,this._totalRowProportions=void 0,this.hasColumnProportion0Child=!1,this.hasRowProportion0Child=!1,this.proportionWidthLength=void 0,this.proportionHeightLength=void 0,sv.call(this),this},layoutChildren:function(){for(var t,e,i,n,s,r,o,a,h,l,u,c,d=this.innerLeft,f=this.innerTop,p=this.space.column,v=this.space.row,g=this.space.indentLeftOdd,y=this.space.indentLeftEven,m=this.space.indentTopOdd,k=this.space.indentTopEven,b=0;b<this.rowCount;b++){c=this.getRowHeight(b),n=d+(b%2?y:g);for(var x=0;x<this.columnCount;x++)u=this.getColumnWidth(x),(t=this.getChildAt(x,b))&&!t.rexSizer.hidden?($g.call(this,t),h=this.getExpandedChildWidth(t,u),l=this.getExpandedChildHeight(t,c),t.isRexSizer?(t.runLayout(this,h,l),Xm(t,this)):uv(t,h,l),s=n+(i=(e=t.rexSizer).padding).left,o=u-i.left-i.right,r=f+(x%2?k:m)+i.top,a=c-i.top-i.bottom,Qg.call(this,t,s,r,o,a,e.align),n+=u+p[x]):n+=u+p[x];f+=c+v[b];}},resolveWidth:function(t){if(void 0!==(t=Zp.call(this,t))&&void 0===this.proportionWidthLength){var e=this.totalColumnProportions;if(e>0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e);}else this.proportionWidthLength=0;}return t},resolveHeight:function(t){if(void 0!==(t=tv.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e);}else this.proportionHeightLength=0;}return t},resolveChildrenWidth:function(t){var e,i,n,s;for(var r in this.sizerChildren)(e=this.sizerChildren[r])&&e.isRexSizer&&!e.ignoreLayout&&(s=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,s),void 0===(n=e.resolveWidth(i))&&(n=i),e.resolveChildrenWidth(n));},resolveChildrenHeight:function(t){var e,i,n,s;for(var r in this.sizerChildren)(e=this.sizerChildren[r])&&e.isRexSizer&&!e.ignoreLayout&&(s=this.getRowHeight(Math.floor(parseInt(r)/this.rowCount)),i=this.getExpandedChildHeight(e,s),void 0===(n=e.resolveHeight(i))&&(n=i),e.resolveChildrenHeight(n));},runWidthWrap:function(t){var e,i,n,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(s=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,s),e.isRexSizer&&void 0===(n=e.resolveWidth(i))&&(n=i),e.runWidthWrap(n));return this},runHeightWrap:function(t){var e,i,n,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(s=this.getRowHeight(Math.floor(parseInt(r)/this.rowCount)),i=this.getExpandedChildHeight(e,s),e.isRexSizer&&void 0===(n=e.resolveHeight(i))&&(n=i),e.runHeightWrap(n));return this},resetGrid:function(t,e,i,n,s){if(void 0===i&&(i=0),void 0===n&&(n=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,xC(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)xC(this.columnProportions,i);else for(var r=0;r<t;r++)this.columnProportions[r]=i[r]||0;if(this.rowProportions=[],this.rowProportions.length=e,"number"==typeof n)xC(this.rowProportions,n);else for(r=0;r<e;r++)this.rowProportions[r]=n[r]||0;this.columnWidth=[],this.columnWidth.length=t,this.rowHeight=[],this.rowHeight.length=e,this.setColumnSpace(SC(s,"column",0)),this.setRowSpace(SC(s,"row",0));var o=this.scene,a=this.createCellContainerCallback;if(a)for(var h=0,l=this.rowCount;h<l;h++)for(var u=0,c=this.columnCount;u<c;u++){var d={column:u,row:h},f=a(o,u,h,d);f&&this.add(f,d);}return this},inseryEmptyRow:PC,addEmptyRow:function(t,e){return PC.call(this,this.rowCount,t,e),this},insertEmptyColumn:TC,addEmptyColumn:function(t,e){return TC.call(this,this.columnCount,t,e),this}};Object.assign(OC,bC,CC,wC);var MC=function(){for(var t,e=0,i=0;i<this.columnCount;i++)(t=this.columnProportions[i])>0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},EC=function(){for(var t,e=0,i=0;i<this.rowCount;i++)(t=this.rowProportions[i])>0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e},_C=Phaser.Utils.Objects.IsPlainObject,RC=Phaser.Utils.Objects.GetValue,LC=function(e){function i(e,n,s,r,o,a,l,u,c,d){var f;return h(this,i),_C(n)?(n=RC(d=n,"x",0),s=RC(d,"y",0),r=RC(d,"width",void 0),o=RC(d,"height",void 0),a=RC(d,"column",d.col||0),l=RC(d,"row",0),u=RC(d,"columnProportions",0),c=RC(d,"rowProportions",0)):_C(r)?(r=RC(d=r,"width",void 0),o=RC(d,"height",void 0),a=RC(d,"column",d.col||0),l=RC(d,"row",0),u=RC(d,"columnProportions",0),c=RC(d,"rowProportions",0)):_C(a)?(a=RC(d=a,"column",d.col||0),l=RC(d,"row",0),u=RC(d,"columnProportions",0),c=RC(d,"rowProportions",0)):_C(u)&&(u=RC(d=u,"columnProportions",0),c=RC(d,"rowProportions",0)),(f=t(this,i,[e,n,s,r,o,d])).type="rexGridSizer",f.sizerChildren=[],f.addChildrenMap("items",f.sizerChildren),f.setCreateCellContainerCallback(RC(d,"createCellContainerCallback")),f.setIndentLeft(RC(d,"space.indentLeftOdd",0),RC(d,"space.indentLeftEven",0)),f.setIndentTop(RC(d,"space.indentTopOdd",0),RC(d,"space.indentTopEven",0)),f.resetGrid(a,l,u,c,RC(d,"space",void 0)),f}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(m(f(i.prototype),"destroy",this).call(this,t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0);}},{key:"setColumnProportion",value:function(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}},{key:"setRowProportion",value:function(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}},{key:"totalColumnProportions",get:function(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=MC.call(this)),this._totalColumnProportions}},{key:"totalRowProportions",get:function(){return void 0===this._totalRowProportions&&(this._totalRowProportions=EC.call(this)),this._totalRowProportions}},{key:"getChildAt",value:function(t,e){return this.sizerChildren[e*this.columnCount+t]}},{key:"childToGridIndex",value:function(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return -1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}},{key:"getColumnWidth",value:function(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}},{key:"getRowHeight",value:function(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}},{key:"setCreateCellContainerCallback",value:function(t){return this.createCellContainerCallback=t,this}}]),i}(Vm);Object.assign(LC.prototype,OC),E.register("gridSizer",(function(t,e,i,n,s,r,o,a,h){var l=new LC(this.scene,t,e,i,n,s,r,o,a,h);return this.scene.add.existing(l),l})),Q(window,"RexPlugins.UI.GridSizer",LC);var BC=function(t,e,i,n){return e/t<=i?e/(n-1):0},DC=function(t){var e,i,n,s,r,o={lines:[],width:0,height:0},a=this.sizerChildren,h=this.space.item,l=this.space.line,u=this.space.indentLeftOdd,c=this.space.indentLeftEven,d=this.space.indentTopOdd,f=this.space.indentTopEven,p=0,v=o.lines,g=void 0;if(0===this.orientation){for(var y=0,m=a.length;y<m;y++){if("\n"===(e=a[y]))e=void 0,n=0,r=!0;else {if(e.rexSizer.hidden)continue;e.isRexSizer&&e.layout(),n=this.getChildWidth(e),r=p<(n+=(i=e.rexSizer.padding).left+i.right)||void 0===g;}r&&(g&&(g.width=t-(p+h),o.width=Math.max(o.width,g.width),o.height+=g.height+l),g={children:[],width:0,height:0},v.push(g),p=t-(v.length%2?u:c)),p-=n+h,e&&(g.children.push(e),s=this.getChildHeight(e),s+=(i=e.rexSizer.padding).top+i.bottom,g.height=Math.max(g.height,s));}g&&(g.width=t-(p+h),o.width=Math.max(o.width,g.width),o.height+=g.height),o.height+=Math.max(d,f);}else {var k=t;for(y=0,m=a.length;y<m;y++){if("\n"===(e=a[y]))e=void 0,n=0,r=!0;else {if(e.rexSizer.hidden)continue;e.isRexSizer&&e.layout(),s=this.getChildHeight(e),r=p<(s+=(i=e.rexSizer.padding).top+i.bottom)||void 0===g;}r&&(g&&(g.height=k-(p+h),o.height=Math.max(o.height,g.height),o.width+=g.width+l),g={children:[],width:0,height:0},v.push(g),p=k-(v.length%2?d:f)),p-=s+h,e&&(g.children.push(e),n=this.getChildWidth(e),n+=(i=e.rexSizer.padding).left+i.right,g.width=Math.max(g.width,n));}g&&(g.height=k-(p+h),o.height=Math.max(o.height,g.height),o.width+=g.width),o.width+=Math.max(u,c);}return o},IC=Phaser.Math.Distance.Between,jC=function(t,e){var i=this.sizerChildren;if(0===i.length)return -1;for(var n=-1,s=1/0,r=0,o=i.length;r<o;r++){var a=i[r];if(!(Math.abs(a.centerY-e)>a.height/2)){s>(h=IC(a.left,a.centerY,t,e))&&(s=h,n=r);var h,l=i[r+1];if(!l||l.y!==a.y)s>(h=IC(a.right,a.centerY,t,e))&&(s=h,n=r+1);}}return n},zC=Phaser.Utils.Objects.IsPlainObject,AC=Phaser.Utils.Objects.GetValue,FC=Phaser.Display.Align.CENTER,WC=function(t,e,i,n){if("\n"===t)return this.addNewLine(),this;var s;(zp.call(this,t),zC(e))&&(e=AC(s=e,"padding",0),i=AC(s,"key",void 0),n=AC(s,"index",void 0));return void 0===e&&(e=0),(s=this.getSizerConfig(t)).align=FC,s.padding=Ip(e),void 0===n||n>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(n,0,t),void 0!==i&&this.addChildrenMap(i,t),this},VC={add:function(t,e,i){if(Ug(t))for(var n=t,s=0,r=n.length;s<r;s++)WC.call(this,n[s],e);else WC.call(this,t,e,i);return this},addNewLine:function(){return this.sizerChildren.push("\n"),this},insert:function(t,e,i,n){return WC.call(this,e,i,n,t),this},insertAtPosition:function(t,e,i,n,s){var r=jC.call(this,t,e);return -1===r&&(r=void 0),this.insert(r,i,n,s),this}},YC=Phaser.Utils.Array.Remove,GC={remove:function(t,e){return this.getParentSizer(t)!==this||(YC(this.sizerChildren,t),Xp.call(this,t,e)),this},removeAll:function(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,Qm.call(this,t),this}},XC={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+this.space.left+this.space.right:void 0);var e;},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+this.space.top+this.space.bottom:void 0);var e;},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n<s;n++)"\n"!==(e=i[n])&&e.isRexSizer&&t.push(e);return t},preLayout:function(){return this._maxChildWidth=void 0,this._maxChildHeight=void 0,this.wrapResult=void 0,this.rexSizer.resolved=!1,sv.call(this),this},layoutChildren:function(){for(var t,e,i,n,s,r,o,a,h,l,u=0===this.orientation,c=u?this.innerWidth:this.innerHeight,d=this.justifyPercentage,f=this.space.item,p=this.space.line,v=this.space.indentLeftOdd,g=this.space.indentLeftEven,y=this.space.indentTopOdd,m=this.space.indentTopEven,k=0,b=this.innerLeft,x=this.innerTop,C=this.wrapResult.lines,w=b,S=x,P=0,T=C.length;P<T;P++){switch(h=(a=C[P]).children,this.rtl&&h.reverse(),u?w=b+(P%2?g:v):S=x+(P%2?m:y),l=c-(u?a.width:a.height),this.align){case 0:break;case 1:u?w+=l:S+=l;break;case 2:u?w+=l/2:S+=l/2;break;case 3:k=BC(c,l,d,h.length);break;case 4:0===(k=BC(c,l,d,h.length))&&(u?w+=l:S+=l);break;case 5:0===(k=BC(c,l,d,h.length))&&(u?w+=l/2:S+=l/2);}for(var O=!0,M=0,E=h.length;M<E;M++)(t=h[M]).rexSizer.hidden||(i=(e=t.rexSizer).padding,$g.call(this,t),u?n=w+i.left:s=S+i.top,O?O=!1:u?n+=f:s+=f,r=Vr(t),o=Yr(t),u?(s=S+(M%2?m:y)+i.top,w=n+r+i.right+k):(n=w+(M%2?g:v)+i.left,S=s+o+i.top+k),Qg.call(this,t,n,s,r,o,e.align));u?S+=a.height+p:w+=a.width+p;}},hasWidthWrap:function(){return 0===this.orientation||$p.call(this)},runWidthWrap:function(t){if(!this.wrapResult&&0===this.orientation){var e=t-this.space.left-this.space.right;this.wrapResult=DC.call(this,e),this.rexSizer.resolved=!0,Qp.call(this,t);}},hasHeightWrap:function(){return 1===this.orientation||ev.call(this)},runHeightWrap:function(t){if(!this.wrapResult&&1===this.orientation){var e=t-this.space.top-this.space.bottom;this.wrapResult=DC.call(this,e),this.rexSizer.resolved=!0,iv.call(this,t);}}};Object.assign(XC,VC,GC);var HC=function(t){void 0===t&&(t=this.sizerChildren);for(var e,i,n=0,s=!1,r=0,o=t.length;r<o;r++)"\n"!==(e=t[r])&&(void 0===(i=this.getChildWidth(e))&&(s=!0),s||(n=Math.max(i,n)));if(!s)return n},UC=function(t){void 0===t&&(t=this.sizerChildren);for(var e,i,n=0,s=!1,r=0,o=t.length;r<o;r++)"\n"!==(e=t[r])&&(void 0===(i=this.getChildHeight(e))&&(s=!0),s||(n=Math.max(i,n)));if(!s)return n},NC=Phaser.Utils.Objects.IsPlainObject,KC=Phaser.Utils.Objects.GetValue,JC=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),NC(n)?(n=KC(a=n,"x",0),s=KC(a,"y",0),r=KC(a,"width",void 0),o=KC(a,"height",void 0)):NC(r)&&(r=KC(a=r,"width",void 0),o=KC(a,"height",void 0)),(l=t(this,i,[e,n,s,r,o,a])).type="rexFixWidthSizer",l.sizerChildren=[],l.setOrientation(KC(a,"orientation",0)),l.setItemSpacing(KC(a,"space.item",0)),l.setLineSpacing(KC(a,"space.line",0)),l.setIntentLeft(KC(a,"space.indentLeftOdd",0),KC(a,"space.indentLeftEven",0)),l.setIntentTop(KC(a,"space.indentTopOdd",0),KC(a,"space.indentTopEven",0)),l.setAlign(KC(a,"align",0)),l.setJustifyPercentage(KC(a,"justifyPercentage",.25)),l.setRTL(KC(a,"rtl",!1)),l.wrapResult=void 0,l.addChildrenMap("items",l.sizerChildren),l}return d(i,e),u(i,[{key:"setOrientation",value:function(t){return this.orientation=Tx(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setLineSpacing",value:function(t){return this.space.line=t,this}},{key:"setIntentLeft",value:function(t,e){return this.space.indentLeftOdd=t,this.space.indentLeftEven=e,this}},{key:"setIntentTop",value:function(t,e){return this.space.indentTopOdd=t,this.space.indentTopEven=e,this}},{key:"setAlign",value:function(t){return "string"==typeof t&&(t=qC[t]),this.align=t,this}},{key:"setJustifyPercentage",value:function(t){return this.justifyPercentage=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"maxChildWidth",get:function(){return void 0===this._maxChildWidth&&(this._maxChildWidth=HC.call(this)),this._maxChildWidth}},{key:"maxChildHeight",get:function(){return void 0===this._maxChildHeight&&(this._maxChildHeight=UC.call(this)),this._maxChildHeight}}]),i}(Vm),qC={left:0,top:0,right:1,bottom:1,center:2,justify:3,"justify-left":3,"justify-top":3,"justify-right":4,"justify-bottom":4,"justify-center":5};Object.assign(JC.prototype,XC),E.register("fixWidthSizer",(function(t,e,i,n,s){var r=new JC(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.FixWidthSizer",JC),E.register("overlapSizer",(function(t,e,i,n,s){var r=new rk(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Q(window,"RexPlugins.UI.OverlapSizer",rk),E.register("space",(function(){return new dx(this.scene)})),Q(window,"RexPlugins.UI.Space",dx),E.register("label",(function(t){var e=new Ix(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Label",Ix);var ZC=function(t,e){var i,n;switch(e&&(e.hasOwnProperty("type")?i=e.type:e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"image":n=new eC(t,e);break;case"nineSlice":n=e.hasOwnProperty("stretchMode")?new q(t,e):new aC(t,e);break;default:n=new iC(t,e);}return t.add.existing(n),n},$C=Phaser.Utils.Objects.GetValue,QC=Phaser.GameObjects.BitmapText,tw=function(t,e){var i,n=$C(e,"$type");switch(void 0===n&&$C(e,"key")&&(n="bitmaptext"),n){case"bitmaptext":case"bitmap":var s=$C(e,"key"),r=$C(e,"size");void 0===r&&(r=$C(e,"fontSize")),i=new QC(t,0,0,s,"",r);var o=$C(e,"color");void 0!==o&&i.setTint(o);break;case"bbcodetext":case"bbcode":i=new wn(t,0,0,"",e);break;default:i=new uC(t,e);}return t.add.existing(i),i},ew=Phaser.GameObjects.BitmapText,iw=function(t){return t instanceof ew},nw=Phaser.GameObjects.Text,sw=function(t){return t instanceof nw},rw=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof pr}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):iw(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,n=e-i.left-i.right,s=t.style;return sw(t)?(s.wordWrapWidth=n,s.maxLines=0):(0===s.wrapMode&&(s.wrapMode=1),s.wrapWidth=n,s.maxLines=0),s.fixedWidth=e,s.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t},ow=function(t,e){var i=new eC(t,e);return t.add.existing(i),i},aw=Phaser.Utils.Objects.GetValue,hw=function(t,e,i){e=e?R(e):{};var n=aw(i,"background",ZC),s=aw(i,"text",tw),r=aw(i,"icon",ow),o=aw(i,"action",ow);if(n?e.background=n(t,e.background):delete e.background,s){var a=aw(e,"wrapText",!1);a&&(!0===a&&(a="word"),Q(e,"text.wrap.mode",a),e.expandTextWidth=!0),e.text=s(t,e.text),a&&(e.text=rw(e.text));}else delete e.text;return r&&null!==e.icon?e.icon=r(t,e.icon):delete e.icon,o&&null!==e.action?e.action=o(t,e.action):delete e.action,e},lw=function(e){function i(e,n,s){var r;return h(this,i),(r=t(this,i,[e,n=hw(e,n,s)])).type="rexSimpleLabel",r}return d(i,e),u(i,[{key:"setActiveState",value:function(t){return uw(this.getChildren(),"setActiveState",t),this}},{key:"setHoverState",value:function(t){return uw(this.getChildren(),"setHoverState",t),this}},{key:"setDisableState",value:function(t){return uw(this.getChildren(),"setDisableState",t),this}}]),i}(Ix),uw=function(t,e,i){for(var n=0,s=t.length;n<s;n++){var r=t[n];r&&r[e]&&r[e](i);}};E.register("simpleLabel",(function(t,e){var i=new lw(this.scene,t,e);return this.scene.add.existing(i),i})),Q(window,"RexPlugins.UI.SimpleLabel",lw);var cw=Phaser.Utils.Objects.GetValue,dw=Phaser.Utils.Objects.GetValue,fw=Phaser.Utils.Objects.GetValue,pw=[function(t){var e=this.scene,i=cw(t,"orientation",0);this.setOrientation(i);var n=cw(t,"icon",void 0),s=cw(t,"iconMask",void 0),r=cw(t,"innerBackground",void 0),o=cw(t,"title",void 0),a=cw(t,"separator",void 0),h=cw(t,"text",void 0),l=cw(t,"action",void 0),u=cw(t,"actionMask",void 0);if(n){g=0===this.orientation?{right:cw(t,"space.icon",0),top:cw(t,"space.iconTop",0),bottom:cw(t,"space.iconBottom",0),left:cw(t,"space.iconLeft",0)}:{bottom:cw(t,"space.icon",0),left:cw(t,"space.iconLeft",0),right:cw(t,"space.iconRight",0),top:cw(t,"space.iconTop",0)};var c=cw(t,"squareFitIcon",!1)?1:0;if(this.add(n,{proportion:0,padding:g,fitRatio:c}),s&&(s=Bx.call(this,n,n,1)),!c){var d=cw(t,"iconSize",void 0);this.setIconSize(cw(t,"iconWidth",d),cw(t,"iconHeight",d));}}var f=new Ex(e,{orientation:1});r&&f.addBackground(r);var p=cw(t,"space.separator",0);if(o){var v=cw(t,"align.title","left"),g={bottom:!a&&h?p:0,left:cw(t,"space.titleLeft",0),right:cw(t,"space.titleRight",0)};f.add(o,{proportion:0,align:v,padding:g});}if(a){g={top:o?p:0,bottom:h?p:0,left:cw(t,"space.separatorLeft",0),right:cw(t,"space.separatorRight",0)};f.add(a,{expand:!0,padding:g});}if(h){v=cw(t,"align.text","left"),g={left:cw(t,"space.textLeft",0),right:cw(t,"space.textRight",0)};f.add(h,{proportion:0,align:v,padding:g});}g=void 0;if(l&&(g={right:cw(t,"space.text",0)}),this.add(f,{proportion:1,padding:g}),l){g=0===this.orientation?{top:cw(t,"space.actionTop",0),bottom:cw(t,"space.actionBottom",0),right:cw(t,"space.actionRight",0)}:{left:cw(t,"space.actionLeft",0),right:cw(t,"space.actionRight",0),bottom:cw(t,"space.actionBottom",0)};c=cw(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,padding:g,fitRatio:c}),u&&(u=Bx.call(this,l,l,1)),!c){var y=cw(t,"actionSize");this.setActionSize(cw(t,"actionWidth",y),cw(t,"actionHeight",y));}}this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",s),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("title",o),this.addChildrenMap("separator",a),this.addChildrenMap("text",h),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",u);},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=dw(t,"title",void 0),n=dw(t,"separator",void 0),s=dw(t,"innerBackground",void 0),r=dw(t,"icon",void 0),o=dw(t,"iconMask",void 0),a=dw(t,"text",void 0),h=dw(t,"action",void 0),l=dw(t,"actionMask",void 0);if(i){var u=dw(t,"align.title","left"),c={bottom:dw(t,"space.title",0),left:dw(t,"space.titleLeft",0),right:dw(t,"space.titleRight",0)};this.add(i,{proportion:0,align:u,padding:c});}if(n){var d=dw(t,"space.separator",0);c={top:i?d:0,bottom:a?d:0,left:dw(t,"space.separatorLeft",0),right:dw(t,"space.separatorRight",0)};this.add(n,{proportion:0,expand:!0,padding:c});}var f=dw(t,"orientation",0),p=new Ex(e,{orientation:f,rtl:dw(t,"rtl",!1),space:{left:dw(t,"space.innerLeft",0),right:dw(t,"space.innerRight",0),top:dw(t,"space.innerTop",0),bottom:dw(t,"space.innerBottom",0)}});if(s&&p.addBackground(s),this.add(p,{proportion:1,expand:!0}),r){c=void 0;c=0===p.orientation?{right:dw(t,"space.icon",0),top:dw(t,"space.iconTop",0),bottom:dw(t,"space.iconBottom",0),left:dw(t,"space.iconLeft",0)}:{bottom:dw(t,"space.icon",0),left:dw(t,"space.iconLeft",0),right:dw(t,"space.iconRight",0),top:dw(t,"space.iconTop",0)};var v=dw(t,"squareFitIcon",!1)?1:0;if(p.add(r,{proportion:0,padding:c,fitRatio:v}),o&&(o=Bx.call(this,r,r,1)),!v){var g=dw(t,"iconSize",void 0);this.setIconSize(dw(t,"iconWidth",g),dw(t,"iconHeight",g));}}if(a){u=dw(t,"align.text","left");var y,m,k=dw(t,"space.text",0),b=dw(t,"expandTextWidth",!1),x=dw(t,"expandTextHeight",!1);0===p.orientation?(y=b?1:0,h&&(c={right:k}),m=x):(y=x?1:0,h&&(c={bottom:k}),m=b),p.add(a,{proportion:y,expand:m,align:u,padding:c});}if(h){c=0===p.orientation?{top:dw(t,"space.actionTop",0),bottom:dw(t,"space.actionBottom",0),right:dw(t,"space.actionRight",0)}:{left:dw(t,"space.actionLeft",0),right:dw(t,"space.actionRight",0),bottom:dw(t,"space.actionBottom",0)};v=dw(t,"squareFitAction",!1)?1:0;if(p.add(h,{proportion:0,padding:c,fitRatio:v}),l&&(l=Bx.call(this,h,h,1)),!v){var C=dw(t,"actionSize");this.setActionSize(dw(t,"actionWidth",C),dw(t,"actionHeight",C));}}this.addChildrenMap("title",i),this.addChildrenMap("separator",n),this.addChildrenMap("innerSizer",p),this.addChildrenMap("innerBackground",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",o),this.addChildrenMap("text",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l);}],vw=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).type="rexTitleLabel";var r=fw(n,"background",void 0);r&&s.addBackground(r);var o=fw(n,"layoutMode",0);return (pw[o]||pw[0]).call(v(s),n),s.addChildrenMap("background",n.background),s}return d(i,e),u(i,[{key:"title",get:function(){var t=this.childrenMap.title;return t?t.title:""},set:function(t){var e=this.childrenMap.title;e&&e.setText(t);}},{key:"setTitle",value:function(t){return this.title=t,this}},{key:"resetDisplayContent",value:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),m(f(i.prototype),"resetDisplayContent",this).call(this,t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}]),i}(Lx);E.register("titleLabel",(function(t){var e=new vw(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.TitleLabel",vw);var gw=Phaser.Utils.Objects.GetValue,yw=Phaser.Utils.Objects.IsPlainObject,mw=function(t,e){var i=gw(e,"background",void 0),n=gw(e,"icon",void 0),s=gw(e,"iconMask",void 0),r=gw(e,"nameText",void 0),o=gw(e,"valueText",void 0),a=gw(e,"bar",void 0),h=gw(e,"action",void 0),l=gw(e,"actionMask",void 0),u="line"===gw(e,"barShape","line");yw(a)&&(a=new(u?Ld:bd)(t,a),t.add.existing(a),r&&t.children.moveBelow(a,r),o&&t.children.moveBelow(a,o));var c=r||o||a;if(i&&this.addBackground(i),n){var d=void 0;0===this.orientation?(c||h)&&(d={right:gw(e,"space.icon",0),top:gw(e,"space.iconTop",0),bottom:gw(e,"space.iconBottom",0)}):(c||h)&&(d={bottom:gw(e,"space.icon",0),left:gw(e,"space.iconLeft",0),right:gw(e,"space.iconRight",0)}),this.add(n,{proportion:0,padding:d}),s&&(s=Bx.call(this,n,n,1));}if(c){var f,p=new Ex(t,{orientation:1});if(r||o){if(f=new Ex(t,{orientation:0}),r){""===r.text&&r.setText(" "),r.setOrigin(0,r.originY);var d={left:gw(e,"space.name",0)};f.add(r,{padding:d});}if(o){""===o.text&&o.setText(" "),o.setOrigin(1,o.originY),f.addSpace();d={right:gw(e,"space.value",0)};f.add(o,{padding:d}),this.setValueTextFormatCallback(gw(e,"valueTextFormatCallback",kw),gw(e,"valueTextFormatCallbackScope",void 0));}p.add(f,{expand:!0});}if(a)if(u){var v=f?gw(e,"space.bar"):0;void 0===v&&(v=gw(e,"space.barTop",0));d={top:v,bottom:gw(e,"space.barBottom",0),left:gw(e,"space.barLeft",0),right:gw(e,"space.barRight",0)};p.add(a,{expand:!0,padding:d});}else {d={top:gw(e,"space.barTop",0),bottom:gw(e,"space.barBottom",0),left:gw(e,"space.barLeft",0),right:gw(e,"space.barRight",0)};this.addBackground(a,d);}d=void 0;h&&(d={right:gw(e,"space.text",0)});var g=gw(e,"align.text","bottom");this.add(p,{proportion:1,align:g,padding:d});}h&&(d=0===this.orientation?{top:gw(e,"space.actionTop",0),bottom:gw(e,"space.actionBottom",0)}:{left:gw(e,"space.actionLeft",0),right:gw(e,"space.actionRight",0)},this.add(h,{proportion:0,padding:d}),l&&(l=Bx.call(this,h,h,1)));this.addChildrenMap("background",i),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",s),this.addChildrenMap("name",r),this.addChildrenMap("value",o),this.addChildrenMap("bar",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l);},kw=function(t,e,i){return t.toString()},bw=Phaser.Math.Clamp,xw={setValueTextFormatCallback:function(t,e){return this.valueTextFormatCallback=t,this.valueTextFormatCallbackScope=e,this},getFormatValueText:function(t,e,i){return void 0===t&&(t=this.value),void 0===e&&(e=this.minValue),void 0===i&&(i=this.maxValue),this.valueTextFormatCallbackScope?this.valueTextFormatCallback(t,e,i):this.valueTextFormatCallback.call(this.valueTextFormatCallbackScope,t,e,i)},updateValueText:function(t,e,i){var n=this.childrenMap.value;return n&&this.valueTextFormatCallback&&(n.setText(this.getFormatValueText(t,e,i)),n.layout&&n.layout()),this},setValue:function(t,e,i){return t=bw(t,e,i),this.value=t,this.minValue=e,this.maxValue=i,this.updateValueText(t,e,i),this.setBarValue(t,e,i),this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},easeValueTo:function(t,e,i){return this.minValue=e,this.maxValue=i,void 0===this.easeValueTask&&(this.easeValueTask=new vc(this),this.easeValueTask.on("update",(function(){this.setValue(this.value,this.minValue,this.maxValue);}),this)),this.easeValueTask.restart({key:"value",to:t,duration:this.easeValueDuration}),this}},Cw=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).type="rexNameValueLabel",mw.call(v(s),e,n),s.setEaseValueDuration(1e3),s}return d(i,e),u(i,[{key:"nameText",get:function(){var t=this.childrenMap.name;return void 0===t?"":t.text},set:function(t){var e=this.childrenMap.name;void 0!==e&&e.setText(t);}},{key:"setNameText",value:function(t){return this.nameText=t,this}},{key:"valueText",get:function(){var t=this.childrenMap.value;return void 0===t?"":t.text},set:function(t){var e=this.childrenMap.value;void 0!==e&&e.setText(t);}},{key:"setValueText",value:function(t){return this.valueText=t,this}},{key:"barValue",get:function(){var t=this.childrenMap.bar;if(void 0!==t)return t.value},set:function(t){var e=this.childrenMap.bar;void 0!==e&&e.setValue(t);}},{key:"setBarValue",value:function(t,e,i){var n=this.childrenMap.bar;return void 0===n||n.setValue(t,e,i),this}},{key:"easeBarValueTo",value:function(t,e,i){var n=this.childrenMap.bar;return void 0===n||n.easeValueTo(t,e,i),this}},{key:"setTexture",value:function(t,e){var i=this.childrenMap.icon;if(void 0!==i)return i.setTexture(t,e),this}},{key:"texture",get:function(){var t=this.childrenMap.icon;if(void 0!==t)return t.texture}},{key:"frame",get:function(){var t=this.childrenMap.icon;if(void 0!==t)return t.frame}},{key:"postLayout",value:function(t,e,i){var n=this.childrenMap.iconMask;n&&(n.setPosition(),this.resetChildPositionState(n));var s=this.childrenMap.actionMask;return s&&(s.setPosition(),this.resetChildPositionState(s)),this}},{key:"resize",value:function(t,e){m(f(i.prototype),"resize",this).call(this,t,e);var n=this.childrenMap.iconMask;n&&n.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}]),i}(Ex);Object.assign(Cw.prototype,xw),E.register("nameValueLabel",(function(t){var e=new Cw(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.NameValueLabel",Cw);var ww=function(e){function i(e){var n;h(this,i),(n=t(this,i)).setTable(wt(e,"table")),n.setMaxLevel(wt(e,"maxLevel"));var s=wt(e,"exp",0),r=wt(e,"level",void 0);return void 0===r||n.checkLevel(r,s)||(console.error("Level ".concat(r," and Exp ").concat(s," are mismatch")),r=void 0),n.resetExp(s,r),n}return d(i,e),u(i,[{key:"setTable",value:function(t){return this.levelTable=t,this.isLevelMapFunction=Gg(t),this}},{key:"setMaxLevel",value:function(t){var e;return void 0===t&&(t=Array.isArray(this.levelTable)?this.levelTable.length-1:-1),e=-1!==t?this.getExp(t):-1,this.hasMaxLevel=-1!==t,this.maxLevel=t,this.maxExp=e,this}},{key:"resetExp",value:function(t,e){return this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),void 0===e&&(e=this.getLevel(t)),this._exp=t,this._level=e,this._requiredExp=this.getRequiredExpToNextLevel(e,t),this}},{key:"exp",get:function(){return this._exp},set:function(t){if(this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),t<this._exp)this.resetExp(t);else if(t!==this._exp){for(var e,i=this.getLevel(t,this._level),n=this._level,s=this._exp;;){var r=this.getExp(n),o=this.getExp(n+1);if(e=Math.min(o,t),this.emit("levelup",n,s,e,r,o),n===i&&e===t)break;n++,s=o;}this.resetExp(t,i);}}},{key:"level",get:function(){return this._level},set:function(t){this.hasMaxLevel&&t>this.maxLevel?this.exp=this.maxExp:this.exp=this.getExp(t);}},{key:"requiredExp",get:function(){return this._requiredExp}},{key:"getExp",value:function(t){return void 0===t?this._exp:this.isLevelMapFunction?this.levelTable(t):(this.hasMaxLevel&&t>this.maxLevel&&(t=this.maxLevel),this.levelTable[t])}},{key:"getLevel",value:function(t,e){if(void 0===t)return this._level;for(void 0===e&&(e=0);;){var i=this.getExp(e+1);if(i>t)break;if(e++,this.hasMaxLevel&&i===this.maxExp)break}return e}},{key:"getRequiredExpToNextLevel",value:function(t,e){return void 0===t&&(t=this.level),void 0===e&&(e=this.exp),this.getExp(t+1)-e}},{key:"checkLevel",value:function(t,e){return e>=this.getExp(t)&&e<this.getExp(t+1)}},{key:"gainExp",value:function(t,e,i){return e&&this.on("levelup",e,i),this.exp+=t,e&&this.off("levelup",e,i),this}},{key:"setExp",value:function(t,e,i){return e&&this.on("levelup",e,i),this.exp=t,e&&this.off("levelup",e,i),this}},{key:"setLevel",value:function(t,e,i){return e&&this.on("levelup",e,i),this.level=t,e&&this.off("levelup",e,i),this}}]),i}(ug),Sw=function t(e,i,n){var s,r=wt(n,"reverse",!1);if(Ug(e[0]))if(r)for(o=(a=e.length)-1;o>=0;o--)s=t(e[o],i,n);else for(var o=0,a=e.length;o<a;o++)s=t(e[o],i,n);else s=Pw(e,i,n);return s},Pw=function(t,e,i){var n,s=wt(i,"argsConvert",void 0),r=wt(i,"argsConvertScope",void 0),o=t[0];if(Tw=Nu(Tw,t,1),s){!0===s&&(s=Ma,r=void 0);for(var a=0,h=Tw.length;a<h;a++)Tw[a]=r?s.call(r,Tw[a],t):s(Tw[a],t);}return "string"==typeof o?null==(n=e[o])&&(n=wt(e,o,null)):n=o,n.apply(e,Tw)},Tw=[],Ow=Phaser.Utils.Objects.GetValue,Mw=function(e){function i(e,n){var s;h(this,i),s=t(this,i,[e,n]);var r=Ow(n,"clock",void 0);return r||(r=new aa(e)),s.clock=r,s.clock.on("update",s.update,v(s)),s.commands=[],s.resetFromJSON(n),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.clock.resetFromJSON(Ow(t,"clock",void 0)),this.state=Ow(t,"state",0),this.commands=Ow(t,"commands",[]),this.scope=Ow(t,"scope",void 0),this.setTimeUnit(Ow(t,"timeUnit",0)),this.setDtMode(Ow(t,"dtMode",0)),this.index=Ow(t,"index",0),this.nextTime=Ow(t,"nextTime",0),this}},{key:"toJSON",value:function(){return {clock:this.clock.toJSON(),state:this.state,commands:this.commands,scope:this.scope,timeUnit:this.timeUnit,dtMode:this.dtMode,index:this.index,nextTime:this.nextTime}}},{key:"shutdown",value:function(t){this.isShutdown||(this.clock.shutdown(t),this.commands=void 0,m(f(i.prototype),"shutdown",this).call(this,t));}},{key:"load",value:function(t,e,i){this.stop();var n=Ow(i,"timeUnit",void 0);void 0!==n&&this.setTimeUnit(n);var s=Ow(i,"dtMode",void 0);return void 0!==s&&this.setDtMode(s),t=t.filter((function(t){var e=t[0];return !isNaN(e)})).map((function(t){return "string"==typeof t[0]&&(t[0]=parseFloat(t[0])),t})),0===this.dtMode&&t.sort((function(t,e){var i=t[0],n=e[0];return i>n?1:i<n?-1:0})),Nu(this.commands,t),this.scope=e,this}},{key:"clear",value:function(){return this.commands.length=0,this}},{key:"append",value:function(t,e){var i;if(Array.isArray(e))i=e;else {for(var n=arguments.length,s=new Array(n>2?n-2:0),r=2;r<n;r++)s[r-2]=arguments[r];i=[e].concat(s);}return this.commands.push([t,i]),this}},{key:"start",value:function(t){return void 0===t&&(t=0),this.stop(),this.index=0,this.state=1,this.nextTime=this.getNextDt(0),this.clock.start(t),this.update(t),this.emit("start",this.parent,this),this}},{key:"pause",value:function(){return this.clock.pause(),this.emit("pause",this.parent,this),this}},{key:"resume",value:function(){return this.clock.resume(),this.emit("resume",this.parent,this),this}},{key:"stop",value:function(){return this.clock.stop(),this.state=0,this.emit("stop",this.parent,this),this}},{key:"seek",value:function(t){return this.clock.seek(t),this}},{key:"seekToNext",value:function(){return this.seek(this.nextTime),this}},{key:"isPlaying",get:function(){return this.clock.isRunning}},{key:"completed",get:function(){return 2===this.state}},{key:"timeScale",get:function(){return this.clock.timeScale},set:function(t){this.clock.timeScale=t;}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"now",get:function(){return this.clock.now}},{key:"update",value:function(t){if(this.nextTime>t)return this;for(var e=this.commands;;){var i=e[this.index],n=i[1];if(Ug(n)||(n=Nu(Ew,i,1)),Sw(n,this.scope),this.emit("runcommand",n,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}},{key:"complete",value:function(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this);}},{key:"getNextDt",value:function(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}},{key:"setDtMode",value:function(t){return "string"==typeof t&&(t=Rw[t]),this.dtMode=t,this}},{key:"setTimeUnit",value:function(t){return "string"==typeof t&&(t=_w[t]),this.timeUnit=t,this}}]),i}(mo),Ew=[],_w={ms:0,s:1,sec:1},Rw={abs:0,absolute:0,inc:1,increment:1},Lw=function(t,e,i,n,s){var r=(i-e)/(s-n)*this.totalEaseDuration,o=i===s?t+1:t;this.player.append(0,this.setEaseValueDuration,r).append(0,this.easeValueTo,i,n,s).append(0,this.emit,"levelup.start",t,e,i,this).append(r,z).append(0,this.emit,"levelup.end",o,e,i,this),this.player.isPlaying||this.player.start();},Bw=Phaser.Utils.Objects.GetValue,Dw=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).type="rexExpBar",s.setTotalEaseDuration(Bw(n,"easeDuration",1e3)),s.levelCounter=new ww(Bw(n,"levelCounter")),s.player=new Mw(v(s),{scope:v(s),dtMode:1}),s.levelCounter.on("levelup",Lw,v(s)),s.player.on("complete",(function(){this.player.clear(),this.emit("levelup.complete",this.level,this);}),v(s)),s.setValue(s.exp,s.getExp(s.level),s.getExp(s.level+1)),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.levelCounter.destroy(),this.levelCounter=void 0,this.player.destroy(),this.player=void 0,m(f(i.prototype),"destroy",this).call(this,t));}},{key:"exp",get:function(){return this.levelCounter.exp},set:function(t){this.levelCounter.exp=t;}},{key:"level",get:function(){return this.levelCounter.level},set:function(t){this.levelCounter.level=t;}},{key:"requiredExp",get:function(){return this.levelCounter.requiredExp}},{key:"setTotalEaseDuration",value:function(t){return this.totalEaseDuration=t,this}}]),i}(Cw);Object.assign(Dw.prototype,{setExpTable:function(t){return this.levelCounter.setTable(t),this},resetExp:function(t){return this.levelCounter.resetExp(t),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1)),this},getExp:function(t){return this.levelCounter.getExp(t)},getLevel:function(t,e){return this.levelCounter.getLevel(t,e)},getRequiredExpToNextLevel:function(t,e){return this.levelCounter.getRequiredExpToNextLevel(t,e)},gainExp:function(t){return this.levelCounter.gainExp(t),this},setExp:function(t){return this.levelCounter.setExp(t),this},setLevel:function(t){return this.levelCounter.setLevel(t),this}}),E.register("expBar",(function(t){var e=new Dw(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.ExpBar",Dw);var Iw=Ex.prototype.add,jw=Ex.prototype.addSpace,zw=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&jw.call(this),Iw.call(this,t,{proportion:i,expand:!0});var n=!this.buttonsExpand&&"center"===this.buttonsAlign;n&&jw.call(this),this.hasTailSpace=n;}else Iw.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var s=this.sizerChildren.length-1;Iw.call(this,t,{index:s,proportion:i,expand:!0});}else Iw.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Aw={addButton:function(t){if(Ug(t))for(var e=t,i=0,n=e.length;i<n;i++)zw.call(this,e[i]);else zw.call(this,t);return this},addButtons:function(t){for(var e=0,i=t.length;e<i;e++)zw.call(this,t[e]);return this}},Fw=Ex.prototype.remove,Ww=Ex.prototype.clear,Vw=function(t,e){return this.getParentSizer(t)!==this||(this.buttonGroup.remove(t),Fw.call(this,t,e)),this},Yw={remove:function(t,e){if(Ug(t))for(var i=t,n=0,s=i.length;n<s;n++)Vw.call(this,i[n],e);else Vw.call(this,t,e);return this},clear:function(t){return this.buttonGroup.buttons.length=0,Ww.call(this,t),this},removeButton:function(t,e){return (t=this.getButton(t))?(this.remove(t,e),this):this},clearButtons:function(t){for(var e=this.buttonGroup.buttons,i=e.length-1;i>=0;i--)Vw.call(this,e[i],t);return this}},Gw=function(t,e,i){if(t){var n=this.setValueCallback,s=this.setValueCallbackScope;n&&(s?n.call(s,t,e,i):n(t,e,i)),this.fireEvent("button.statechange",t,e,i);}},Xw=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var n=t._selected;t._selected=i,Gw.call(e,t,i,n);}},enumerable:!0,configurable:!0}),t.selected=!1;},Hw={add:function(t){return this.buttons.push(t),t._click||(t._click=new wc(t,this.clickConfig),t._click.on("click",(function(t,e,i,n){this.fireEvent("button.click",e,i,n);}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e);}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e);}),this).on("over",(function(t,e,i,n){this.fireEvent("button.over",e,i,n);}),this).on("out",(function(t,e,i,n){this.fireEvent("button.out",e,i,n);}),this).on("down",(function(t,e,i,n){this.fireEvent("button.down",e,i,n);}),this).on("up",(function(t,e,i,n){this.fireEvent("button.up",e,i,n);}),this)),this.buttonsType&&(void 0===t.name&&console.error("".concat(this.parent.constructor.name,": Option button miss value")),Xw.call(this,t)),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)this.add(t[e]);return this}},Uw=Phaser.Utils.Array.Remove,Nw={remove:function(t){return this.buttonsType&&delete t.selected,Uw(this.buttons,t),this},clear:function(){if(this.buttonsType)for(var t=this.buttons,e=0,i=t.length;e<i;e++)delete t[e].selected;return this.buttons.length=0,this}},Kw=Phaser.Utils.Objects.GetValue,Jw={setButtonsType:function(t){void 0===t&&(t={});var e,i,n=Kw(t,"buttonsType",t.type);if(this.buttonsType=n,!this.buttonsType)return this;switch(e=Kw(t,"setValueCallback",void 0),i=Kw(t,"setValueCallbackScope",void 0),void 0===e&&(e=Kw(t,"setButtonStateCallback",void 0),i=Kw(t,"setButtonStateCallbackScope",void 0)),this.setValueCallback=e,this.setValueCallbackScope=i,n){case"radio":this.setRadioType();break;case"checkboxes":this.setCheckboxesType();}return this},setRadioType:function(){var t=this.parent,e=this.buttons;t._value=void 0;var i=void 0;return Object.defineProperty(t,"value",{get:function(){return t._value},set:function(n){if(t._value!==n){t._value=n;for(var s=0,r=e.length;s<r;s++){var o=e[s];o.rexSizer.hidden||(void 0===i?o.name===n?o.selected=!0:o.selected=!1:o.selected=i===s);}}},enumerable:!0,configurable:!0}),t.on("button.click",(function(e){i=this.buttons.indexOf(e),t.value=e.name,i=void 0;}),this),this},setCheckboxesType:function(){return this.parent.on("button.click",(function(t){t.selected=!t.selected;})),this},clearAllButtonsState:function(){for(var t=this.buttons,e=0,i=t.length;e<i;e++){t[e].selected=!1;}return this},getAllButtonsState:function(){for(var t={},e=this.buttons,i=0,n=e.length;i<n;i++){var s=e[i];s.rexSizer.hidden||(t[s.name]=s.selected);}return t},setSelectedButtonName:function(t){return this.parent.value=t,this},getSelectedButtonName:function(){return this.parent.value},setButtonState:function(t,e){void 0===e&&(e=!0);for(var i=this.buttons,n=0,s=i.length;n<s;n++){var r=i[n];if(!r.rexSizer.hidden&&r.name===t){r.selected=e;break}}return this},getButtonState:function(t){for(var e=this.buttons,i=0,n=e.length;i<n;i++){var s=e[i];if(!s.rexSizer.hidden&&s.name===t)return s.selected}}},qw=function(t,e){return t?t.hasOwnProperty("name")?t.name===e?t:null:GetElementByName(t,e):null},Zw={getButton:function(t){var e,i=this.buttons;switch(o(t)){case"number":e=i[t];break;case"string":e=function(t,e){if(!t)return null;if(Ug(t)){for(var i,n=0,s=t.length;n<s;n++)if(i=qw(t[n],e))return i}else for(var r in t)if(i=qw(t[r],e))return i}(i,t);break;default:e=t,-1===i.indexOf(e)&&(e=void 0);}return e},getButtons:function(){return this.buttons},setButtonEnable:function(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var n=0,s=i.length;n<s;n++)i[n]._click.setEnable(e);}else this.getButton(t)._click.setEnable(e);return this},toggleButtonEnable:function(t){var e=this.buttons;if(void 0===t||"boolean"==typeof t)for(var i=0,n=e.length;i<n;i++)e[i]._click.toggleEnable();else this.getButton(t)._click.toggleEnable();return this},getButtonEnable:function(t){return void 0===t&&(t=0),this.getButton(t)._click.enable},emitButtonClick:function(t){return (this.buttonGroup?this.buttonGroup:this).fireEvent("button.click",t),this},emitButtonOver:function(t){for(var e=this.buttonGroup?this.buttonGroup:this,i=this.buttons,n=0,s=i.length;n<s;n++){(r=i[n])._click.isOver&&(r._click.isOver=!1,e.fireEvent("button.out",r));}var r;return (r=this.getButton(t))&&(r._click.isOver=!0,e.fireEvent("button.over",r)),this},showButton:function(t){return ng(this.getButton(t)),this},hideButton:function(t){return sg(this.getButton(t)),this},isButtonShown:function(t){return rg(this.getButton(t)),this},forEachButtton:function(t,e){for(var i=this.buttons,n=0,s=i.length;n<s;n++)e?t.call(e,i[n],n,i):t(i[n],n,i);return this}},$w=function(){function t(e){h(this,t),this.parent=e.parent,this.eventEmitter=e.eventEmitter,this.groupName=e.groupName,this.clickConfig=e.clickConfig,this.buttonsType=void 0,this.buttons=[];}return u(t,[{key:"destroy",value:function(){this.parent=void 0,this.eventEmitter=void 0,this.clickConfig=void 0,this.buttons=void 0;}}]),t}(),Qw={fireEvent:function(t,e){if(this.buttons){var i,n,s,r;if("number"==typeof e){if(i=e,!(e=this.buttons[i]))return}else if(-1===(i=this.buttons.indexOf(e)))return;for(var o=arguments.length,a=new Array(o>2?o-2:0),h=2;h<o;h++)a[h-2]=arguments[h];if(this.eventEmitter!==this.parent)(n=this.parent).emit.apply(n,[t,e,i].concat(a));if(void 0!==this.groupName)(s=this.eventEmitter).emit.apply(s,[t,e,this.groupName,i].concat(a));else (r=this.eventEmitter).emit.apply(r,[t,e,i].concat(a));}}};Object.assign($w.prototype,Hw,Nw,Jw,Zw,Qw);var tS={clearAllButtonsState:function(){return this.buttonGroup.clearAllButtonsState(),this},getAllButtonsState:function(){return this.buttonGroup.getAllButtonsState()},setSelectedButtonName:function(t){return this.buttonGroup.setSelectedButtonName(t),this},getSelectedButtonName:function(){return this.buttonGroup.getSelectedButtonName()},setButtonState:function(t,e){return this.buttonGroup.setButtonState(t,e),this},getButtonState:function(t){return this.buttonGroup.getButtonState(t)}},eS=Phaser.Utils.Objects.GetValue,iS=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={});var r=n.space;"number"==typeof r&&(n.space={item:r}),(s=t(this,i,[e,n])).type="rexButtons",s.buttonGroup=new $w({parent:v(s),eventEmitter:eS(n,"eventEmitter",v(s)),groupName:eS(n,"groupName",void 0),clickConfig:eS(n,"click",void 0)}).setButtonsType(n);var o=eS(n,"background",void 0),a=eS(n,"buttons",void 0);return s.buttonsExpand=eS(n,"expand",!1),s.buttonsAlign=eS(n,"align",void 0),o&&s.addBackground(o),a&&s.addButtons(a),s.addChildrenMap("background",o),s.addChildrenMap("buttons",s.buttonGroup.buttons),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(m(f(i.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0);}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t;}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),i}(Ex);Object.assign(iS.prototype,Aw,Yw,Zw,tS),E.register("buttons",(function(t){var e=new iS(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Buttons",iS);var nS=LC.prototype.add,sS={addButton:function(t,e,i){return nS.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons:function(t,e){for(var i=0,n=t;i<n;i++)this.addButton(t[i],void 0,e);return this}},rS=LC.prototype.remove,oS=LC.prototype.clear,aS=function(t,e){return (t=this.getButton(t))?(this.buttonGroup.remove(t),rS.call(this,t,e),this):this},hS={remove:function(t,e){if(Ug(t))for(var i=t,n=0,s=i.length;n<s;n++)aS.call(this,i[n],e);else aS.call(this,t,e);return this},clear:function(t){return this.buttonGroup.buttons.length=0,oS.call(this,t),this},removeButton:function(t,e){return this.remove(t,e),this},clearButtons:function(t){for(var e=this.buttonGroup.buttons,i=e.length-1;i>=0;i--)aS.call(this,e[i],t);return this}},lS=Phaser.Utils.Objects.GetValue,uS=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={});var r=lS(n,"row",0),o=lS(n,"column",n.col||0),a=lS(n,"createCellContainerCallback"),l=lS(n,"buttons",void 0),u=lS(n,"expand",!0),c=u?1:0;if(a&&(n.createCellContainerCallback=void 0),void 0!==l){r=Math.max(r,l.length);for(var d=0,f=l.length;d<f;d++)o=Math.max(o,l[d].length);}n.row=r,n.column=o,n.columnProportions=c,n.rowProportions=c,(s=t(this,i,[e,n])).type="rexGridButtons",s.buttonGroup=new $w({parent:v(s),eventEmitter:lS(n,"eventEmitter",v(s)),groupName:lS(n,"groupName",void 0),clickConfig:lS(n,"click",void 0)}).setButtonsType(n);var p=lS(n,"background",void 0);if(s.buttonsExpand=u,lS(n,"space",void 0),p&&s.addBackground(p),l)for(var g,y=0,m=l.length;y<m;y++)for(var k=0,b=(g=l[y]).length;k<b;k++)(w=g[k])&&s.addButton(w,k,y);else if(a)for(var x=0;x<r;x++)for(var C=0;C<o;C++){var w;(w=a(e,C,x))&&s.addButton(w,C,x);}return s.addChildrenMap("background",p),s.addChildrenMap("buttons",s.buttonGroup.buttons),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(m(f(i.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0);}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t;}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),i}(LC);Object.assign(uS.prototype,sS,hS,Zw,tS),E.register("gridButtons",(function(t){var e=new uS(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.GridButtons",uS);var cS=JC.prototype.add,dS=function(t){return cS.call(this,t),this.buttonGroup.add(t),this},fS={addButton:function(t){if(Ug(t))for(var e=t,i=0,n=e.length;i<n;i++)dS.call(this,e[i]);else dS.call(this,t);return this},addButtons:function(t){if(Ug(t[0]))for(var e,i=t,n=0,s=i.length-1;n<=s;n++){for(var r=0,o=(e=i[n]).length;r<o;r++)dS.call(this,e[r]);n>s&&cS.addNewLine(this);}else for(r=0,o=t.length;r<o;r++)dS.call(this,t[r]);return this}},pS=JC.prototype.remove,vS=JC.prototype.clear,gS=function(t,e){return (t=this.getButton(t))?(this.buttonGroup.remove(t),pS.call(this,t,e),this):this},yS={remove:function(t,e){if(Ug(t))for(var i=t,n=0,s=i.length;n<s;n++)gS.call(this,i[n],e);else gS.call(this,t,e);return this},clear:function(t){return this.buttonGroup.buttons.length=0,vS.call(this,t),this},removeButton:function(t,e){return this.remove(t,e),this},clearButtons:function(t){for(var e=this.buttonGroup.buttons,i=e.length-1;i>=0;i--)gS.call(this,e[i],t);return this}},mS=Phaser.Utils.Objects.GetValue,kS=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={});var r=n.space;"number"==typeof r&&(n.space={item:r,line:r}),(s=t(this,i,[e,n])).type="rexFixWidthButtons",s.buttonGroup=new $w({parent:v(s),eventEmitter:mS(n,"eventEmitter",v(s)),groupName:mS(n,"groupName",void 0),clickConfig:mS(n,"click",void 0)}).setButtonsType(n);var o=mS(n,"background",void 0),a=mS(n,"buttons",void 0);return s.buttonsAlign=mS(n,"align",void 0),o&&s.addBackground(o),a&&s.addButtons(a),s.addChildrenMap("background",o),s.addChildrenMap("buttons",s.buttonGroup.buttons),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(m(f(i.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0);}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t;}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),i}(JC);Object.assign(kS.prototype,fS,yS,Zw,tS),E.register("fixWidthButtons",(function(t){var e=new kS(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.FixWidthButtons",kS);var bS=Phaser.Utils.Objects.GetValue,xS=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).type="rexFileSelectorButton";var r=new ex(e);return e.add.existing(r),s.addBackground(r),s.addChildrenMap("fileChooser",r),s.setAccept(bS(n,"accept","")),s.setMultiple(bS(n,"multiple",!1)),r.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this));}),v(s)),s}return d(i,e),u(i,[{key:"files",get:function(){return this.childrenMap.fileChooser.files}}]),i}(Ix);Object.assign(xS.prototype,{setAccept:function(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple:function(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile:function(t,e,i,n,s){return this.childrenMap.fileChooser.loadFile(t,e,i,n,s),this},loadFilePromise:function(t,e,i,n){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,n)}}),E.register("fileSelectorButton",(function(t){var e=new xS(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.FileSelectorButton",xS);var CS={getChoice:function(t){var e=this.childrenMap.choicesSizer;return e?e.getButton(t):void 0},getAction:function(t){return this.childrenMap.actionsSizer.getButton(t)},getToolbar:function(t){return this.childrenMap.toolbarSizer.getButton(t)},getLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.getButton(t)},setChoiceEnable:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonEnable(t,e),this},setActionEnable:function(t,e){return this.childrenMap.actionsSizer.setButtonEnable(t,e),this},setToolbarEnable:function(t,e){return this.childrenMap.toolbarSizer.setButtonEnable(t,e),this},setLeftToolbarEnable:function(t,e){return this.childrenMap.leftToolbarSizer.setButtonEnable(t,e),this},toggleChoiceEnable:function(t){var e=this.childrenMap.choicesSizer;return e&&e.toggleButtonEnable(t),this},toggleActionEnable:function(t){return this.childrenMap.actionsSizer.toggleButtonEnable(t),this},toggleToolbarEnable:function(t){return this.childrenMap.toolbarSizer.toggleButtonEnable(t),this},toggleLeftToolbarEnable:function(t){return this.childrenMap.leftToolbarSizer.toggleButtonEnable(t),this},getChoiceEnable:function(t){var e=this.childrenMap.choicesSizer;return !!e&&e.getButtonEnable(t)},getActionEnable:function(t){return this.childrenMap.actionsSizer.getButtonEnable(t)},getToolbarEnable:function(t){return this.childrenMap.toolbarSizer.getButtonEnable(t)},getLeftToolbarEnable:function(t){return this.childrenMap.leftToolbarSizer.getButtonEnable(t)},emitChoiceClick:function(t){var e=this.childrenMap.choicesSizer;return e&&e.emitButtonClick(t),this},emitActionClick:function(t){return this.childrenMap.actionsSizer.emitButtonClick(t),this},emitToolbarClick:function(t){return this.childrenMap.toolbarSizer.emitButtonClick(t),this},emitLeftToolbarClick:function(t){return this.childrenMap.leftToolbarSizer.emitButtonClick(t),this},showChoice:function(t){var e=this.childrenMap.choicesSizer;return e&&e.showButton(t),this},showAction:function(t){return this.childrenMap.actionsSizer.showButton(t),this},showToolbar:function(t){return this.childrenMap.toolbarSizer.showButton(t),this},showLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.showButton(t),this},hideChoice:function(t){var e=this.childrenMap.choicesSizer;return e&&e.hideButton(t),this},hideAction:function(t){return this.childrenMap.actionsSizer.hideButton(t),this},hideToolbar:function(t){return this.childrenMap.toolbarSizer.hideButton(t),this},hideLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.hideButton(t),this},addChoice:function(t){var e=this.childrenMap.choicesSizer;return e&&e.addButton(t),this},addAction:function(t){return this.childrenMap.actionsSizer.addButton(t),this},addToolbar:function(t){return this.childrenMap.toolbarSizer.addButton(t),this},addLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.addButton(t),this},removeChoice:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.removeButton(t,e),this},removeAction:function(t,e){return this.childrenMap.actionsSizer.removeButton(t,e),this},removeToolbar:function(t,e){return this.childrenMap.toolbarSizer.removeButton(t,e),this},removeLeftToolbar:function(t,e){return this.childrenMap.leftToolbarSizer.removeButton(t,e),this},clearChoices:function(t){var e=this.childrenMap.choicesSizer;return e&&e.clearButtons(t),this},clearActions:function(t){return this.childrenMap.actionsSizer.clearButtons(t),this},clearToolbar:function(t){return this.childrenMap.toolbarSizer.clearButtons(t),this},clearLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.clearButtons(t),this},forEachChoice:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.forEachButtton(t,e),this},forEachAction:function(t,e){return this.childrenMap.actionsSizer.forEachButtton(t,e),this},forEachToolbar:function(t,e){return this.childrenMap.toolbarSizer.forEachButtton(t,e),this},forEachLeftToolbar:function(t,e){return this.childrenMap.leftToolbarSizer.forEachButtton(t,e),this},setAllButtonsEnable:function(t){return void 0===t&&(t=!0),this.childrenMap.toolbarSizer&&this.setToolbarEnable(t),this.childrenMap.leftToolbarSizer&&this.setLeftToolbarEnable(t),this.childrenMap.actionsSizer&&this.setActionEnable(t),this.childrenMap.choicesSizer&&this.setChoiceEnable(t),this},getChoicesButtonStates:function(){var t=this.childrenMap.choicesSizer;return t?t.getAllButtonsState():{}},getChoicesButtonState:function(t){var e=this.childrenMap.choicesSizer;return void 0===t?e?e.getAllButtonsState():{}:!!e&&e.getButtonState(t)},setChoicesButtonState:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonState(t,e),this},clearChoicesButtonStates:function(){var t=this.childrenMap.choicesSizer;return t&&t.clearAllButtonsState(),this},getChoicesSelectedButtonName:function(){var t=this.childrenMap.choicesSizer;return t?t.getSelectedButtonName():""},setChoicesSelectedButtonName:function(t){var e=this.childrenMap.choicesSizer;return e&&e.setSelectedButtonName(t),this}},wS={onCreateModalBehavior:function(t){t.on("button.click",(function(e,i,n,s,r){if("actions"===i){var o={index:n,text:e.text,button:e,dialog:t};switch(t.buttonsType){case"radio":o.value=t.getChoicesSelectedButtonName();break;case"checkboxes":o.value=t.getChoicesButtonStates();break;default:o.value=void 0;}t.modalClose(o);}}));},modal:function(t,e){return t&&!1===t.defaultBehavior?this.onCreateModalBehavior=!1:delete this.onCreateModalBehavior,Xg.modal.call(this,t,e),this}},SS={};Object.assign(SS,CS,wS);var PS=Phaser.Utils.Objects.GetValue,TS=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),n.orientation=1,(s=t(this,i,[e,n])).type="rexDialog",s.eventEmitter=PS(n,"eventEmitter",v(s));var r,o,a,l,u=PS(n,"background",void 0),c=PS(n,"title",void 0),d=PS(n,"toolbar",void 0),f=PS(n,"toolbarBackground",void 0),p=PS(n,"leftToolbar",void 0),g=PS(n,"leftToolbarBackground",void 0),y=PS(n,"content",void 0),m=PS(n,"description",void 0),k=PS(n,"choices",void 0),b=PS(n,"choicesBackground",void 0),x=PS(n,"actions",void 0),C=PS(n,"actionsBackground",void 0),w=PS(n,"click",void 0);if(u&&s.addBackground(u),d&&(a=new iS(e,{groupName:"toolbar",background:f,buttons:d,orientation:0,space:{item:PS(n,"space.toolbarItem",0)},click:w,eventEmitter:s.eventEmitter})),p&&(l=new iS(e,{groupName:"leftToolbar",background:g,buttons:p,orientation:0,space:{item:PS(n,"space.leftToolbarItem",0)},click:w,eventEmitter:s.eventEmitter})),c||d||p){var S,P=!!c&&PS(n,"expand.title",!0),T=PS(n,"align.title","center"),O=!(c&&!P&&"center"===T||!c&&(d||p));S=O?new Ex(e,{orientation:0}):new rk(e);var M=!!O||{height:!0};if(l&&S.add(l,{align:"left",expand:M}),c){O&&!P&&"right"===T&&S.addSpace();var E={left:PS(n,"space.titleLeft",0),right:PS(n,"space.titleRight",0)},_=P?1:0;S.add(c,{align:T,proportion:_,expand:M,padding:E}),O&&!P&&"left"===T&&S.addSpace();}a&&(O&&!c&&S.addSpace(),S.add(a,{align:"right",expand:M})),(y||m||k||x)&&(E={bottom:PS(n,"space.title",0),top:PS(n,"space.titleTop",0)});_=PS(n,"proportion.title",0);s.add(S,{padding:E,proportion:_,expand:!0});}if(y){var R=PS(n,"align.content","center"),L=PS(n,"space.content",0),B=(E={left:PS(n,"space.contentLeft",0),right:PS(n,"space.contentRight",0),bottom:m||k||x?L:0},_=PS(n,"proportion.content",0),PS(n,"expand.content",!0));s.add(y,{align:R,padding:E,proportion:_,expand:B});}if(m){R=PS(n,"align.description","center");var D=PS(n,"space.description",0);E={left:PS(n,"space.descriptionLeft",0),right:PS(n,"space.descriptionRight",0),bottom:k||x?D:0},_=PS(n,"proportion.description",0),B=PS(n,"expand.description",!0);s.add(m,{align:R,padding:E,proportion:_,expand:B});}if(k){var I=PS(n,"choicesType","").split("-"),j=OS(I,"wrap")?kS:OS(I,"grid")?uS:iS,z=OS(I,"radio")?"radio":OS(I,"checkboxes")?"checkboxes":void 0,A={left:PS(n,"space.choicesBackgroundLeft",0),right:PS(n,"space.choicesBackgroundRight",0),top:PS(n,"space.choicesBackgroundTop",0),bottom:PS(n,"space.choicesBackgroundBottom",0)},F=PS(n,"space.choice",0);j===iS?A.item=F:j===kS?(A.item=F,A.line=PS(n,"space.choiceLine",F)):(A.column=PS(n,"space.choiceColumn",F),A.row=PS(n,"space.choiceRow",F));var W={width:PS(n,"choicesWidth",void 0),height:PS(n,"choicesHeight",void 0),groupName:"choices",buttonsType:z,background:b,buttons:k,space:A,click:w,eventEmitter:s.eventEmitter,setValueCallback:PS(n,"choicesSetValueCallback",void 0),setValueCallbackScope:PS(n,"choicesSetValueCallbackScope",void 0)};j===iS&&(W.orientation=OS(I,"x")?0:1),r=new j(e,W);var V=PS(n,"space.choices",0);E={left:PS(n,"space.choicesLeft",0),right:PS(n,"space.choicesRight",0),bottom:x?V:0},R=PS(n,"align.choices","center"),_=PS(n,"proportion.choices",0),B=PS(n,"expand.choices",!0);s.add(r,{align:R,padding:E,proportion:_,expand:B}),s.buttonsType=z;}if(x){o=new iS(e,{groupName:"actions",background:C,buttons:x,orientation:0,space:{item:PS(n,"space.action",0)},expand:PS(n,"expand.actions",!1),align:PS(n,"align.actions","center"),click:w,eventEmitter:s.eventEmitter});E={left:PS(n,"space.actionsLeft",0),right:PS(n,"space.actionsRight",0),bottom:PS(n,"space.actionsBottom",0)},_=PS(n,"proportion.action",0);s.add(o,{align:"center",padding:E,proportion:_,expand:!0});}return ES(v(s),"click"),ES(v(s),"over"),ES(v(s),"out"),ES(v(s),"enable"),ES(v(s),"disable"),s.addChildrenMap("background",u),s.addChildrenMap("title",c),s.addChildrenMap("toolbar",d),s.addChildrenMap("leftToolbar",p),s.addChildrenMap("content",y),s.addChildrenMap("description",m),s.addChildrenMap("choices",r?r.buttons:void 0),s.addChildrenMap("actions",o?o.buttons:void 0),s.addChildrenMap("choicesSizer",r),s.addChildrenMap("actionsSizer",o),s.addChildrenMap("toolbarSizer",a),s.addChildrenMap("leftToolbarSizer",l),s}return d(i,e),u(i)}(Ex),OS=function(t,e){return -1!==t.indexOf(e)},MS={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},ES=function(t,e){t.on("button.".concat(e),(function(i,n,s,r,o){MS.hasOwnProperty(n)&&t.emit("".concat(MS[n],".").concat(e),i,s,r,o);}));};Object.assign(TS.prototype,SS),E.register("dialog",(function(t){var e=new TS(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Dialog",TS);var _S=function(t,e,i){var n=new lw(t,e,i);return t.add.existing(n),n},RS=function(t){this.childrenMap.title.resetDisplayContent(t.title);},LS=function(t){var e=this.childrenMap.content;if(e.resetDisplayContent)e.resetDisplayContent(t.content);else {var i=t.content||"";e.setText(i);}},BS=function(t){var e=this.childrenMap.actions;if(e){var i=t.buttons;if(i){for(var n=this.scene,s=this.defaultActionConfig,r=this.defaultActionButtonCreator,o=0,a=i.length;o<a;o++){var h=i[o],l=e[o];l||(l=_S(n,s,r),this.addAction(l)),l.show().resetDisplayContent(h);}this.buttonMode=i.length;for(o=i.length,a=e.length;o<a;o++)e[o].hide();}else {var u=e[0];u&&u.resetDisplayContent(t.buttonA);var c=e[1];c&&c.resetDisplayContent(t.buttonB);}}},DS=function(t){var e=this.childrenMap.choices;if(e){var i=t.choices;i||(i=[]);for(var n=this.scene,s=this.defaultChoiceConfig,r=this.defaultActionButtonCreator,o=0,a=i.length;o<a;o++){var h=i[o];"string"==typeof h&&(h={text:h});var l,u=e[o];u||(u=_S(n,s,r),this.addChoice(u)),u.show().resetDisplayContent(h),l=h.hasOwnProperty("value")?h.value:h.text,u.setName(l);}for(o=i.length,a=e.length;o<a;o++)e[o].hide();}};Phaser.Utils.Objects.GetValue;var IS={resetDisplayContent:function(t){return void 0===t&&(t={}),RS.call(this,t),LS.call(this,t),BS.call(this,t),DS.call(this,t),this},modal:function(t,e){Gg(t)&&(e=t,t=void 0),void 0===t&&(t={});var i=0===this.buttonMode;t.hasOwnProperty("anyTouchClose")||(t.anyTouchClose=i),t.hasOwnProperty("manualClose")||(t.manualClose=!i);var n=this;return Xg.modal.call(this,t,(function(t){var i=t.index;i===n.confirmButtonIndex?n.emit("confirm",t):i===n.cancelButtonIndex&&n.emit("cancel",t),e&&e(t);})),this}};Object.assign(IS,{setConfirmButtonIndex:function(t){return this.confirmButtonIndex=t,this},setCancelButtonIndex:function(t){return this.cancelButtonIndex=t,this}});var jS=function(t){t.setHoverState&&t.setHoverState(!0);},zS=function(t){t.setHoverState&&t.setHoverState(!1);},AS=function(t,e,i,n){t.setActiveState&&t.setActiveState(n);},FS=function(t){t.setDisableState&&t.setDisableState(!1);},WS=function(t){t.setDisableState&&t.setDisableState(!0);},VS=function(){this.on("button.over",jS).on("button.out",zS).on("button.enable",FS).on("button.disable",WS).on("button.statechange",AS);},YS={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},GS=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=XS(t));var i=t[e];return "string"==typeof i&&(i=YS[i]),i},XS=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},HS=Phaser.Utils.Objects.GetValue,US=Phaser.Math.Percent,NS=function(t,e,i){var n;return t.y===e.y?n=US(i.x,t.x,e.x):t.x===e.x&&(n=US(i.y,t.y,e.y)),n},KS=function(t,e,i){var n,s;this.enable&&(JS.x=e,JS.y=i,this.reverseAxis?(n=this.getEndPoint(),s=this.getStartPoint()):(n=this.getStartPoint(),s=this.getEndPoint()),this.value=NS(n,s,JS));},JS={},qS=function(t,e,i){if(this.enable&&t.isDown){var n,s;ZS.x=t.worldX,ZS.y=t.worldY,this.reverseAxis?(n=this.getEndPoint(),s=this.getStartPoint()):(n=this.getStartPoint(),s=this.getEndPoint());var r=NS(n,s,ZS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-r)<.1?this.value=r:this.easeValueTo(r);}},ZS={},$S=function(t,e){void 0===e&&(e=QS);var i=this.childrenMap.thumb,n=i.x,s=i.y;return Ep(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=n,i.y=s,e},QS={},tP=Phaser.Display.Align.LEFT_CENTER,eP=Phaser.Display.Align.TOP_CENTER,iP={},nP=Phaser.Display.Align.RIGHT_CENTER,sP=Phaser.Display.Align.BOTTOM_CENTER,rP={},oP=Phaser.Math.Linear,aP={},hP=Phaser.Display.Align.LEFT_CENTER,lP=Phaser.Display.Align.TOP_CENTER,uP=Phaser.Display.Align.RIGHT_CENTER,cP=Phaser.Display.Align.BOTTOM_CENTER,dP=Phaser.Utils.Objects.GetValue,fP=Phaser.Utils.Objects.IsPlainObject,pP=Phaser.Math.Clamp,vP=Phaser.Math.Snap.To,gP=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).type="rexSlider",s.bootProgressBase(n),s.reverseAxis=dP(n,"reverseAxis",!1);var r=dP(n,"background",void 0),o=dP(n,"track",void 0),a=dP(n,"indicator",void 0),l=dP(n,"thumb",void 0);r&&(fP(r)&&(r=ZC(e,r)),s.addBackground(r)),o&&(fP(o)&&(o=ZC(e,o)),s.add(o,{proportion:1,expand:!0,minWidth:0===s.orientation?0:void 0,minHeight:1===s.orientation?0:void 0})),a&&(fP(a)&&(a=ZC(e,a)),s.pin(a)),l&&(fP(l)&&(l=ZC(e,l)),s.pin(l));var u=dP(n,"input",0);switch("string"==typeof u&&(u=yP[u]),u){case 0:l&&(l.setInteractive(),s.scene.input.setDraggable(l),l.on("drag",KS,v(s)).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t);}),v(s)).on("dragend",(function(t){this.eventEmitter.emit("inputend",t);}),v(s)));break;case 1:s.on("pointerdown",qS,v(s)).on("pointermove",qS,v(s)).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t);}),v(s)).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t);}),v(s)).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t);}),v(s)).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t);}),v(s)).setInteractive();}return s.addChildrenMap("background",r),s.addChildrenMap("track",o),s.addChildrenMap("indicator",a),s.addChildrenMap("thumb",l),s.setEnable(dP(n,"enable",void 0)),s.setGap(dP(n,"gap",void 0)),s.setValue(dP(n,"value",0),dP(n,"min",void 0),dP(n,"max",void 0)),s}return d(i,e),u(i,[{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setGap",value:function(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}},{key:"value",get:function(){return this._value},set:function(t){void 0!==this.gap&&(t=vP(t,this.gap));var e=this._value;this._value=pP(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter));}},{key:"postLayout",value:function(t,e,i){return this.updateThumb(),this.updateIndicator(),this}}]),i}(ed(Ex)),yP={pan:0,drag:0,click:1,none:-1},mP={getStartPoint:function(t){if(void 0===t&&(t=iP),this.childrenMap.thumb){var e=0===this.orientation?tP:eP;$S.call(this,e,t);}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=rP),this.childrenMap.thumb){var e=0===this.orientation?nP:sP;$S.call(this,e,t);}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,n=this.childrenMap.thumb;return void 0===n||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,n){void 0===n&&(n=aP),n.x=oP(e.x,i.x,t),n.y=oP(e.y,i.y,t);}(t,e,i,n),this.resetChildPositionState(n)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,n,s,r=this.reverseAxis,o=this.childrenMap.thumb;if(o)if(0===this.orientation){var a=Vr(o);if(r){h=o.x-a*o.originX;i=this.right-h;}else {var h;i=(h=o.x-a*o.originX)+a-this.left;}}else {var l=Yr(o);if(r){u=o.y-l*o.originY;n=this.bottom-u;}else {var u;n=(u=o.y-l*o.originY)+l-this.top;}}else 0===this.orientation?i=this.width*t:n=this.height*t;uv(e,i,n),s=r?0===this.orientation?uP:cP:0===this.orientation?hP:lP,Mp(e,this,s),this.resetChildPositionState(e);}};Object.assign(gP.prototype,mP);var kP=Phaser.Utils.Objects.GetValue,bP=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).type="rexScrollBar";var r,o=kP(n,"background",void 0),a=kP(n,"buttons",void 0),l=kP(a,"top",kP(a,"left",void 0)),u=kP(a,"bottom",kP(a,"right",void 0)),c=kP(n,"slider",void 0);(o&&s.addBackground(o),l)&&(s.add(l),new ly(l).on("intouch",(function(){if(this.enable){var t=r.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t;}}),v(s)));if(c){var d;if(c.orientation=s.orientation,c.eventEmitter=v(s),c.value=null,0===s.orientation)d=void 0===kP(c,"width",void 0)?1:0;else d=void 0===kP(c,"height",void 0)?1:0;r=new gP(e,c),e.add.existing(r),s.add(r,{proportion:d});}u&&(s.add(u),new ly(u).on("intouch",(function(){if(this.enable){var t=r.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t;}}),v(s)));var f=[l,u];s.addChildrenMap("background",o),s.addChildrenMap("slider",r),s.addChildrenMap("buttons",f);var p=kP(n,"valuechangeCallback",null);if(null!==p){var g=kP(n,"valuechangeCallbackScope",void 0);s.on("valuechange",p,g);}return s.setEnable(kP(n,"enable",void 0)),s.setValue(kP(n,"value",0)),s.setScrollStep(kP(a,"step",.01)),s}return d(i,e),u(i,[{key:"setScrollStep",value:function(t){return this.scrollStep=t,this}},{key:"enable",get:function(){return !!this.childrenMap.slider&&this.childrenMap.slider.enable},set:function(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"value",get:function(){return this.childrenMap.slider?this.childrenMap.slider.value:0},set:function(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t);}},{key:"setValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}},{key:"addValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}},{key:"getValue",value:function(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}},{key:"easeValueTo",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}},{key:"stopEaseValue",value:function(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}},{key:"setEaseValueDuration",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}},{key:"setEaseValueFunction",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}]),i}(Ex),xP=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[n])).parent=e,s.init(),s}return d(i,e),u(i,[{key:"init",value:function(){this.start("IDLE");}},{key:"next_IDLE",value:function(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}},{key:"update_IDLE",value:function(t,e){this.next();}},{key:"next_DRAGBEGIN",value:function(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}},{key:"update_DRAGBEGIN",value:function(t,e){this.next();}},{key:"next_DRAG",value:function(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}},{key:"update_DRAG",value:function(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next();}},{key:"enter_DRAG",value:function(){this.parent.onDragStart();}},{key:"exit_DRAG",value:function(){this.parent.onDragEnd();}},{key:"next_SLIDE",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}},{key:"enter_SLIDE",value:function(){this.parent.onSliding();}},{key:"exit_SLIDE",value:function(){this.parent.stop();}},{key:"update_SLIDE",value:function(t,e){this.parent.sliding(t,e),this.next();}},{key:"next_BACK",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}},{key:"enter_BACK",value:function(){this.parent.onPullBack();}},{key:"exit_BACK",value:function(){this.parent.stop();}},{key:"update_BACK",value:function(t,e){this.parent.pullBack(t,e),this.next();}}]),i}(gg),CP=Phaser.Utils.Objects.GetValue,wP=Phaser.Math.Distance.Between,SP=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n]))._enable=void 0,e.setInteractive(CP(n,"inputConfig",void 0)),s.resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(CP(t,"enable",!0)),this.holdThreshold=CP(t,"holdThreshold",50),this.pointerOutReleaseEnable=CP(t,"pointerOutRelease",!0),this}},{key:"boot",value:function(){this.parent.on("pointerdown",this.onPointIn,this),this.parent.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&this.parent.on("pointerout",this.onPointOut,this),this.parent.on("pointermove",this.onPointerMove,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,m(f(i.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setPointerOutReleaseEnable",value:function(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}},{key:"isDown",get:function(){return this.pointer&&this.pointer.isDown}},{key:"isUp",get:function(){return !this.isDown}},{key:"dx",get:function(){return this.x-this.preX}},{key:"dy",get:function(){return this.y-this.preY}},{key:"dt",get:function(){return yu(this.scene)}},{key:"speed",get:function(){return this.x===this.preX&&this.y===this.preY?0:wP(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}},{key:"speedX",get:function(){return this.dx/(.001*this.dt)}},{key:"speedY",get:function(){return this.dy/(.001*this.dt)}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.localX=e,this.localY=i);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0);}},{key:"onPointerMove",value:function(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.localX=e,this.localY=i);}},{key:"preupdate",value:function(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i));}}}]),i}(mo),PP=Phaser.Utils.Objects.GetValue,TP=function(){function t(e){h(this,t),this.resetFromJSON(e);}return u(t,[{key:"resetFromJSON",value:function(t){return this.setValue(PP(t,"value",0)),this.setSpeed(PP(t,"speed",0)),this.setAcceleration(PP(t,"acceleration",0)),this}},{key:"reset",value:function(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0);}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setAcceleration",value:function(t){return this.acceleration=t,this}},{key:"updateSpeed",value:function(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}},{key:"getDeltaValue",value:function(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}},{key:"update",value:function(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}},{key:"isMoving",get:function(){return this.speed>0}}]),t}(),OP=function(){function t(){h(this,t),this.value,this.dir,this.movement=new TP;}return u(t,[{key:"init",value:function(t,e,i,n,s){return this.value=t,this.end=s,this.dir=void 0!==s?t<s:e,this.movement.setSpeed(i).setAcceleration(-n),this}},{key:"stop",value:function(){this.movement.reset();}},{key:"update",value:function(t){var e=this.movement.getDeltaValue(t);return this.dir||(e=-e),void 0===this.end?this.value+=e:0===e?this.value=this.end:(this.value+=e,this.dir?this.value>this.end&&(this.value=this.end):this.value<this.end&&(this.value=this.end)),this}},{key:"isMoving",get:function(){return this.movement.isMoving}}]),t}(),MP=Phaser.Utils.Objects.GetValue,EP=Phaser.Math.Clamp,_P=function(e){function i(e,n){var s;h(this,i),s=t(this,i,[e,n]);var r=MP(n,"enable",!0);s._state=new xP(v(s),{enable:r,eventEmitter:!1});var o={inputConfig:MP(n,"inputConfig",void 0),enable:r,pointerOutRelease:MP(n,"pointerOutRelease",!0),eventEmitter:!1};s.dragState=new SP(e,o),s._enable=void 0,s._value=void 0,s._slowDown=new OP;var a=MP(n,"valuechangeCallback",null);if(null!==a){var l=MP(n,"valuechangeCallbackScope",void 0);s.on("valuechange",a,l);}if(null!==(a=MP(n,"overmaxCallback",null))){l=MP(n,"overmaxCallbackScope",void 0);s.on("overmax",a,l);}if(null!==(a=MP(n,"overminCallback",null))){l=MP(n,"overminCallbackScope",void 0);s.on("overmin",a,l);}return s.resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){this.setOrientationMode(MP(t,"orientation",0)),this.setDragThreshold(MP(t,"threshold",10)),this.setSlidingDeceleration(MP(t,"slidingDeceleration",5e3)),this.setBackDeceleration(MP(t,"backDeceleration",2e3));var e=MP(t,"dragRate",1);e*=MP(t,"dragReverse",!1)?-1:1,this.setDragRate(e);var i=MP(t,"bounds",void 0);return i?this.setBounds(i):this.setBounds(MP(t,"max",0),MP(t,"min",0)),this.setValue(MP(t,"value",this.maxValue||0)),this.setEnable(MP(t,"enable",!0)),this}},{key:"boot",value:function(){this.scene.sys.events.on("preupdate",this._state.update,this._state);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this._state.update,this._state),this._state.destroy(t),this.dragState.destroy(t),this._state=void 0,this.dragState=void 0,m(f(i.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return this._enable=t,this._state.setEnable(t),this.dragState.setEnable(t),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setOrientationMode",value:function(t){return "string"==typeof t&&(t=RP[t]),this.orientationMode=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setSlidingDeceleration",value:function(t){return this.slidingDeceleration=t,this}},{key:"setBackDeceleration",value:function(t){return this.backDeceleration=t,this}},{key:"setDragRate",value:function(t){return this.dragRate=t,this}},{key:"setBounds",value:function(t,e){if(Array.isArray(t)){var i=t;t=i[0],e=i[1];}return t<e?(this.minValue=t,this.maxValue=e):(this.minValue=e,this.maxValue=t),this}},{key:"value",get:function(){return this._value},set:function(t){if(t!==this._value){var e=this._value,i=this.overMax(t),n=this.overMin(t);i&&this.emit("overmax",t,e),n&&this.emit("overmin",t,e),this.backEnable||(i&&(t=this.maxValue),n&&(t=this.minValue)),this._value=t,this.emit("valuechange",t,e);}}},{key:"setValue",value:function(t,e){return void 0===e&&(e=!1),e&&(t=EP(t,this.minValue,this.maxValue)),this.value=t,this}},{key:"addValue",value:function(t,e){return this.setValue(this.value+t,e),this}},{key:"state",get:function(){return this._state.state}},{key:"isDragging",get:function(){return this.dragState.isInTouched}},{key:"outOfMaxBound",get:function(){return this.overMax(this.value)}},{key:"outOfMinBound",get:function(){return this.overMin(this.value)}},{key:"outOfBounds",get:function(){return this.outOfMinBound||this.outOfMaxBound}},{key:"overMax",value:function(t){return null!=this.maxValue&&t>this.maxValue}},{key:"overMin",value:function(t){return null!=this.minValue&&t<this.minValue}},{key:"backEnable",get:function(){return "number"==typeof this.backDeceleration}},{key:"isPullBack",get:function(){return this._slowDown.isMoving}},{key:"slidingEnable",get:function(){return "number"==typeof this.slidingDeceleration}},{key:"isSliding",get:function(){return this._slowDown.isMoving}},{key:"dragDelta",get:function(){var t;return t=0===this.orientationMode?this.dragState.dy:1===this.orientationMode?this.dragState.dx:0,t*=this.dragRate}},{key:"dragSpeed",get:function(){var t;return t=0===this.orientationMode?this.dragState.speedY:1===this.orientationMode?this.dragState.speedX:0,t*=this.dragRate}},{key:"onDragStart",value:function(){this.emit("dragstart");}},{key:"onDragEnd",value:function(){this.emit("dragend");}},{key:"dragging",value:function(){this.value+=this.dragDelta;}},{key:"onSliding",value:function(){var t=this.value,e=this.dragSpeed;if(0===e)return this._slowDown.stop(),void this._state.next();var i=this.slidingDeceleration;this._slowDown.init(t,e>0,Math.abs(e),i);}},{key:"sliding",value:function(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i;}},{key:"onPullBack",value:function(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),n=this.backDeceleration,s=Math.sqrt(2*n*i);this._slowDown.init(t,void 0,s,n,e);}},{key:"pullBack",value:function(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next();}},{key:"stop",value:function(){this._slowDown.stop();}}]),i}(mo),RP={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},LP=Phaser.Utils.Objects.GetValue,BP=function(e){function i(e,n){var s;(h(this,i),(s=t(this,i,[e,n])).parent!==s.scene?s.focusMode=LP(n,"focus",!0):s.focusMode=!1,s.setSpeed(LP(n,"speed",.1)),s.setEnable(LP(n,"enable",!0)),s.focusMode)?(e=s.parent).setInteractive(LP(n,"inputConfig",void 0)).on("wheel",(function(t,e,i,n,s){this.enable&&this.scroll(i);}),v(s)):s.scene.input.on("wheel",s.onSceneScroll,v(s));return s}return d(i,e),u(i,[{key:"destroy",value:function(){this.focusMode||this.scene.input.off("wheel",this.onSceneScroll,this);}},{key:"onSceneScroll",value:function(t,e,i,n,s,r){this.enable&&this.scroll(n);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"scroll",value:function(t){t*=this.speed,this.emit("scroll",t,this.parent,this);}}]),i}(mo),DP=Phaser.Utils.Objects.GetValue,IP=function(t,e,i,n){var s,r,o,a,h="Y"===(i=i.toUpperCase()),l=2===t.scrollMode,u=t.childrenMap.child,c="slider".concat(i);if(s=l||n.hasOwnProperty(c)?DP(n,c,void 0):DP(n,"slider",void 0)){var d,f,p;!0===s&&(s={}),s.orientation=h?1:0,r=function(t,e){void 0===e&&(e={});var i=ni(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var n=new bP(t,e);t.add.existing(n);var s=n.childrenMap.slider;return n.addChildrenMap("track",s.childrenMap.track),n.addChildrenMap("indicator",s.childrenMap.indicator),n.addChildrenMap("thumb",s.childrenMap.thumb),n}(t.scene,s);var v=DP(s,"position",0);"string"==typeof v&&(v=jP[v]);var g,y,m=DP(n,"space.slider".concat(i),void 0);void 0===m&&void 0===(m=DP(n,"space.slider",void 0))&&(l?m=0:g=DP(n,"space.child",0)),y=void 0===g?"number"==typeof m:"number"==typeof g,h?0===v?(d=2,f=1,p=void 0===g?y?{left:m}:m:{left:DP(g,"right",g)}):(d=0,f=1,p=void 0===g?y?{right:m}:m:{right:DP(g,"left",g)}):0===v?(d=1,f=2,p=void 0===g?y?{top:m}:m:{top:DP(g,"bottom",g)}):(d=1,f=0,p=void 0===g?y?{bottom:m}:m:{bottom:DP(g,"top",g)}),e.add(r,{column:d,row:f,align:"center",padding:p,expand:!0}),t["hideUnscrollableSlider".concat(i)]=DP(s,"hideUnscrollableSlider",!1),t["adaptThumb".concat(i,"SizeMode")]=DP(s,"adaptThumbSize",!1),t["minThumb".concat(i,"Size")]=DP(s,"minThumbSize",void 0);}else t["hideUnscrollableSlider".concat(i)]=!1,t["adaptThumb".concat(i,"SizeMode")]=!1,t["minThumb".concat(i,"Size")]=void 0;var k="scroller".concat(i);(o=l||n.hasOwnProperty(k)?DP(n,k,!0):DP(n,"scroller",!0))&&u&&(!0===o&&(o={}),o.orientation=h?0:1,a=new _P(u,o));var b,x,C,w,S,P=DP(n,l?"mouseWheelScroller".concat(i):"mouseWheelScroller",!1);(P&&u&&(b=new BP(u,P)),t.addChildrenMap("slider".concat(i),r),t.addChildrenMap("scroller".concat(i),a),t.addChildrenMap("mouseWheelScroller".concat(i),b),l&&!h||(t.hideUnscrollableSlider=t["hideUnscrollableSlider".concat(i)],t.adaptThumbSizeMode=t["adaptThumb".concat(i,"SizeMode")],t.minThumbSize=t["minThumb".concat(i,"Size")],t.addChildrenMap("slider",r),t.addChildrenMap("scroller",a),t.addChildrenMap("mouseWheelScroller",b)),r)&&(l?(x=h?"t":"s",w="scroll".concat(i)):(x="t",w="scroll"),r.on("valuechange",(function(e){t[x]=e,t.emit(w,t);})));a&&(l?(C="childO".concat(i),w="scroll".concat(i)):(C="childOY",w="scroll"),a.on("valuechange",(function(e){t[C]=e,t.emit(w,t);})));b&&(S=l?"addChildO".concat(i):"addChildOY",b.on("scroll",(function(e){t[S](-e,!0);})));},jP={right:0,left:1,bottom:0,top:1},zP=Phaser.Utils.Objects.GetValue,AP=function(t,e){var i=t.scene,n=[0,1,0],s=[0,1,0],r=zP(e,"width"),o=zP(e,"height");r||(zP(e,"child.expandWidth",!0)||(n[1]=0));o||(zP(e,"child.expandHeight",!0)||(s[1]=0));var a=new LC(i,{column:3,row:3,columnProportions:n,rowProportions:s});switch(function(t,e,i){var n=HS(i,"child"),s=HS(n,"gameObject",void 0);if(s){var r=HS(i,"space.child",0);t.childMargin={};var o=t.childMargin,a={};if("number"==typeof r)switch(t.scrollMode){case 0:case 1:o.top=0,o.bottom=0,o.left=0,o.right=0;break;default:o.top=r,o.bottom=r,o.left=r,o.right=r;}else switch(t.scrollMode){case 0:o.top=HS(r,"top",0),o.bottom=HS(r,"bottom",0),a.left=HS(r,"left",0),a.right=HS(r,"right",0);break;case 1:o.top=HS(r,"left",0),o.bottom=HS(r,"right",0),a.top=HS(r,"top",0),a.bottom=HS(r,"bottom",0);break;default:o.top=HS(r,"top",0),o.bottom=HS(r,"bottom",0),o.left=HS(r,"left",0),o.right=HS(r,"right",0);}e.add(s,{column:1,row:1,align:HS(n,"align","center"),padding:a,expand:{width:HS(n,"expandWidth",!0),height:HS(n,"expandHeight",!0)}});}t.addChildrenMap("child",s);}(t,a,e),t.scrollMode){case 0:IP(t,a,"y",e);break;case 1:IP(t,a,"x",e);break;default:IP(t,a,"y",e),IP(t,a,"x",e);}return a},FP=function(t){var e,i,n,s;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,n=this.childrenMap.scroller,s=this.childrenMap.slider;break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),n=this.childrenMap["scroller".concat(t)],s=this.childrenMap["slider".concat(t)];}n&&n.setBounds(e,i),s&&s.setEnable(e!==i);},WP=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap["slider".concat(t)],i=this["hideUnscrollableSlider".concat(t)],n=this["isOverflow".concat(t)];e&&i&&this.setChildVisible(e,n);}},VP=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,n=a.childrenMap.thumb,s=this.minThumbSize;if(0===this.scrollMode){var r=i.displayHeight*e;void 0!==s&&r<s&&(r=s),uv(n,void 0,r);}else {var o=i.displayWidth*e;void 0!==s&&o<s&&(o=s),uv(n,o,void 0);}YP(a);break;default:var a;if(t=t.toUpperCase(),!this["adaptThumb".concat(t,"SizeMode")])return;if(!(a=this.childrenMap["slider".concat(t)]))return;i=a.childrenMap.track,n=a.childrenMap.thumb,s=this["minThumb".concat(t,"Size")];if("Y"===t){e=Math.min(this.childVisibleHeight/this.childHeight,1),r=i.displayHeight*e;void 0!==s&&r<s&&(r=s),uv(n,void 0,r);}else {e=Math.min(this.childVisibleWidth/this.childWidth,1),o=i.displayWidth*e;void 0!==s&&o<s&&(o=s),uv(n,o,void 0);}YP(a);}},YP=function(t){var e=t.minWidth,i=t.minHeight;t.minWidth=t.width,t.minHeight=t.height,t.layout(),t.minWidth=e,t.minHeight=i;},GP=Phaser.Utils.Objects.GetValue,XP=Phaser.Math.Clamp,HP=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={});var r=GS(n),o=1===r;n.orientation=o?0:1,(s=t(this,i,[e,n])).type=GP(n,"type","rexScrollable"),s.scrollMode=r;var a=GP(n,"background",void 0);a&&s.addBackground(a);var l=GP(n,"header",void 0);if(l){var u=GP(n,"align.header","center"),c=GP(n,"space.header",0);p=o?{right:c}:{bottom:c},s.add(l,{proportion:0,align:u,padding:p,expand:GP(n,"expand.header",!0)});}var d=AP(v(s),n);d&&s.add(d,{proportion:1,align:"center",padding:0,expand:!0});var f=GP(n,"footer",void 0);if(f){u=GP(n,"align.footer","center");var p,g=GP(n,"space.footer",0);p=o?{left:g}:{top:g},s.add(f,{proportion:0,align:u,padding:p,expand:GP(n,"expand.footer",!0)});}return s.addChildrenMap("background",a),s.addChildrenMap("header",l),s.addChildrenMap("footer",f),s.runLayoutFlag=!1,s}return d(i,e),u(i,[{key:"postLayout",value:function(t,e,i){var n=0,s=0;return this.runLayoutFlag?(s=this.t,2===this.scrollMode&&(n=this.s)):this.runLayoutFlag=!0,this.resizeController(),this.setT(s),2===this.scrollMode&&this.setS(n),this}},{key:"t",get:function(){var t=this.childrenMap.child.t,e=this.childMargin;if(0!==e.top||0!==e.bottom){var i=this.childrenMap.child,n=i.topChildOY-i.bottomChildOY,s=n+e.top+e.bottom,r=n*t+e.top;t=0!==s?r/s:0;}return t},set:function(t){var e=this.childMargin;if(0!==e.top||0!==e.bottom){var i=this.childrenMap.child,n=i.topChildOY-i.bottomChildOY,s=(n+e.top+e.bottom)*t-e.top;t=0!==n?s/n:0;}this.childrenMap.child.t=t,this.updateController();}},{key:"s",get:function(){var t=this.childrenMap.child.s,e=this.childMargin;if(0!==e.left||0!==e.right){var i=this.childrenMap.child,n=i.leftChildOX-i.rightChildOX,s=n+e.left+e.right,r=n*t+e.left;t=0!==s?r/s:0;}return t},set:function(t){var e=this.childMargin;if(0!==e.left||0!==e.right){var i=this.childrenMap.child,n=i.leftChildOX-i.rightChildOX,s=(n+e.left+e.right)*t-e.left;t=0!==n?s/n:0;}this.childrenMap.child.s=t,this.updateController();}},{key:"childOY",get:function(){return this.childrenMap.child.childOY},set:function(t){this.childrenMap.child.childOY=t,this.updateController();}},{key:"childOX",get:function(){return this.childrenMap.child.childOX},set:function(t){this.childrenMap.child.childOX=t,this.updateController();}},{key:"topChildOY",get:function(){return this.childrenMap.child.topChildOY+this.childMargin.top}},{key:"bottomChildOY",get:function(){return this.childrenMap.child.bottomChildOY-this.childMargin.bottom}},{key:"leftChildOX",get:function(){return this.childrenMap.child.leftChildOX+this.childMargin.left}},{key:"rightChildOX",get:function(){return this.childrenMap.child.rightChildOX-this.childMargin.right}},{key:"childVisibleHeight",get:function(){return this.childrenMap.child.childVisibleHeight}},{key:"childHeight",get:function(){return this.childrenMap.child.childHeight}},{key:"childVisibleWidth",get:function(){return this.childrenMap.child.childVisibleWidth}},{key:"childWidth",get:function(){return this.childrenMap.child.childWidth}},{key:"isOverflow",get:function(){var t=this.childrenMap.child;return t.topChildOY!==t.bottomChildOY}},{key:"isOverflowY",get:function(){return this.isOverflow}},{key:"isOverflowX",get:function(){var t=this.childrenMap.child;return t.leftChildOX!==t.rightChildOX}},{key:"setChildOY",value:function(t,e){return void 0===e&&(e=!1),e&&(t=XP(t,this.bottomChildOY,this.topChildOY)),this.childOY=t,this}},{key:"addChildOY",value:function(t,e){return this.setChildOY(this.childOY+t,e),this}},{key:"setT",value:function(t,e){return void 0===e&&(e=!1),e&&(t=XP(t,0,1)),this.t=t,this}},{key:"addT",value:function(t,e){return this.setT(this.t+t,e),this}},{key:"scrollToTop",value:function(){return this.t=0,this}},{key:"scrollToBottom",value:function(){if(this.t=1,0===this.t)return this;do{this.t=1;}while(1!==this.t);return this}},{key:"setChildOX",value:function(t,e){return void 0===e&&(e=!1),e&&(t=XP(t,this.leftChildOX,this.rightChildOX)),this.childOX=t,this}},{key:"addChildOX",value:function(t,e){return this.setChildOX(this.childOX+t,e),this}},{key:"setS",value:function(t,e){return void 0===e&&(e=!1),e&&(t=XP(t,0,1)),this.s=t,this}},{key:"addS",value:function(t,e){return this.setS(this.s+t,e),this}},{key:"scrollToLeft",value:function(){return this.s=0,this}},{key:"scrollToRight",value:function(){if(this.s=1,0===this.s)return this;do{this.s=1;}while(1!==this.s);return this}},{key:"sliderEnable",get:function(){var t=this.childrenMap.slider;return !!t&&t.enable},set:function(t){var e=this.childrenMap.slider;e&&e.setEnable(t);}},{key:"setSliderEnable",value:function(t){return void 0===t&&(t=!0),this.sliderEnable=t,this}},{key:"sliderYEnable",get:function(){return this.sliderEnable},set:function(t){this.sliderEnable=t;}},{key:"setSliderYEnable",value:function(t){return this.setSliderEnable(t),this}},{key:"sliderXEnable",get:function(){var t=this.childrenMap.sliderX;return !!t&&t.enable},set:function(t){var e=this.childrenMap.sliderX;e&&e.setEnable(t);}},{key:"setSliderXEnable",value:function(t){return void 0===t&&(t=!0),this.sliderXEnable=t,this}},{key:"scrollerEnable",get:function(){var t=this.childrenMap.scroller;return !!t&&t.enable},set:function(t){var e=this.childrenMap.scroller;e&&e.setEnable(t);}},{key:"setScrollerEnable",value:function(t){return void 0===t&&(t=!0),this.scrollerEnable=t,this}},{key:"scrollerYEnable",get:function(){return this.scrollerEnable},set:function(t){this.scrollerEnable=t;}},{key:"setScrollerYEnable",value:function(t){return this.setScrollerEnable(t),this}},{key:"scrollerXEnable",get:function(){var t=this.childrenMap.scrollerX;return !!t&&t.enable},set:function(t){var e=this.childrenMap.scrollerX;e&&e.setEnable(t);}},{key:"setScrollerXEnable",value:function(t){return void 0===t&&(t=!0),this.scrollerXEnable=t,this}},{key:"mouseWheelScrollerEnable",get:function(){var t=this.childrenMap.mouseWheelScroller;return !!t&&t.enable},set:function(t){var e=this.childrenMap.mouseWheelScroller;e&&e.setEnable(t);}},{key:"setMouseWheelScrollerEnable",value:function(t){return void 0===t&&(t=!0),this.mouseWheelScrollerEnable=t,this}},{key:"mouseWheelScrollerYEnable",get:function(){return this.mouseWheelScrollerEnable},set:function(t){this.mouseWheelScrollerEnable=t;}},{key:"setMouseWheelScrollerYEnable",value:function(t){return this.setMouseWheelScrollerEnable(t),this}},{key:"mouseWheelScrollerXEnable",get:function(){var t=this.childrenMap.mouseWheelScrollerX;return !!t&&t.enable},set:function(t){var e=this.childrenMap.mouseWheelScrollerX;e&&e.setEnable(t);}},{key:"setMouseWheelScrollerXEnable",value:function(t){return void 0===t&&(t=!0),this.mouseWheelScrollerXEnable=t,this}},{key:"setDropZoneEnable",value:function(t){void 0===t&&(t=!0);var e=this.childrenMap.child;return e.setInteractive(),e.input.dropZone=t,this}}]),i}(Ex),UP={resizeController:function(){switch(this.scrollMode){case 0:case 1:FP.call(this),this.updateController(),WP.call(this),VP.call(this);break;default:FP.call(this,"y"),FP.call(this,"x"),this.updateController(),WP.call(this,"y"),WP.call(this,"x"),VP.call(this,"y"),VP.call(this,"x");}return this},updateController:function(){switch(this.scrollMode){case 0:case 1:var t=this.childrenMap.scroller,e=this.childrenMap.slider;t&&t.setValue(this.childOY),e&&e.setValue(this.t);break;default:var i=this.childrenMap.scrollerY,n=this.childrenMap.sliderY,s=this.childrenMap.scrollerX,r=this.childrenMap.sliderX;i&&i.setValue(this.childOY),n&&n.setValue(this.t),s&&s.setValue(this.childOX),r&&r.setValue(this.s);}}};Object.assign(HP.prototype,UP);var NP=function(t){return iw(t)?2:sw(t)?0:1},KP=function(t,e,i){switch(NP(t)){case 0:i=t.getWrappedText(e);break;case 1:i=t.getPenManager(e,i);break;case 2:i=t.maxWidth>0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n");}return i},JP=function(t){return (t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},qP=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},ZP=function(t){var e,i=t+this.visibleLinesCount+1;switch(this.textObjectType){case 0:case 2:e=this.lines.slice(t,i).join("\n");break;case 1:var n=this.lines.getLineStartIndex(t),s=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(n,s,!0);}return e},$P=function(t,e){switch(NP(t)){case 0:var i=(s=t.style).wordWrapWidth,n=s.wordWrapCallback;s.wordWrapWidth=0,s.wordWrapCallback=void 0,t.setText(e),s.wordWrapWidth=i,s.wordWrapCallback=n;break;case 1:var s,r=(s=t.style).wrapMode;s.wrapMode=0,t.setText(e),s.wrapMode=r;break;case 2:var o=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=o;}},QP=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&&tT.call(this);},tT=function(){if(this.textObject.setCrop){var t,e,i=this.textObject.rexSizer.offsetY;i<=0?(t=-i,e=this.height):(t=0,e=this.height-i),this.textObject.setCrop(0,t,this.width,e);}},eT=function(t,e,i){if(i+=this.textLineHeight+this.textLineSpacing,this.textObjectWidth!==e||this._textObjectRealHeight!==i){switch(this.textObjectWidth=e,this._textObjectRealHeight=i,this.textObjectType){case 0:case 1:t.setFixedSize(e,i);var n=t.style,s=Math.max(e,0);0===this.textObjectType?n.wordWrapWidth=s:(0===n.wrapMode&&(n.wrapMode=1),n.wrapWidth=s);break;case 2:t.setMaxWidth(e);}this.setText();}},iT={setText:function(t){return void 0!==t&&(this.text=t),this.lines=KP(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(JP.call(this,-this.textOY)),0),e=qP.call(this,t)+this.textOY,i=ZP.call(this,t);return $P(this.textObject,i),this.textObject.rexSizer.offsetY=e,QP.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,sv.call(this),this},layoutChildren:function(){var t,e,i,n,s,r,o,a=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(n=a+(i=(e=t.rexSizer).padding).left,s=h+i.top,r=this.width-i.left-i.right,o=this.height-i.top-i.bottom,eT.call(this,t,r,o),Ep(t,n,s,r,o,e.align),e.preOffsetY=0,QP.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)));}},nT=Phaser.Utils.Objects.IsPlainObject,sT=Phaser.Utils.Objects.GetValue,rT=Phaser.Display.Align.TOP_LEFT,oT=function(e){function i(e,n,s,r,o,a){var l;h(this,i),nT(n)?(n=sT(a=n,"x",0),s=sT(a,"y",0),r=sT(a,"width",void 0),o=sT(a,"height",void 0)):nT(r)&&(r=sT(a=r,"width",void 0),o=sT(a,"height",void 0)),(l=t(this,i,[e,n,s,r,o,a])).type="rexTextBlock",l.textObject=void 0,l.linesCount=0,l.textMask=void 0,l.textObjectType=void 0,l._textLineHeight=void 0,l._textLineSpacing=void 0,l._visibleLinesCount=void 0,l._textHeight=void 0,l._textVisibleHeight=void 0,l._textObjectRealHeight=0,l.lines=void 0,l.text=sT(a,"content",""),l._textOY=0,l.execeedTopState=!1,l.execeedBottomState=!1,l.setClampMode(sT(a,"clamplTextOY",!0)),l.alwaysScrollable=sT(a,"alwaysScrollable",!1);var u=sT(a,"background",void 0),c=sT(a,"text",void 0);void 0===c&&(c=aT(e)),l.textCropEnable=sT(a,"textCrop",!!c.setCrop);var d=sT(a,"textMask",!l.textCropEnable);u&&l.addBackground(u),l.add(c),l.sizerChildren=[c];var f=l.getSizerConfig(c);return f.align=rT,f.padding=Ip(0),f.expand=!0,l.textObject=c,l.textObjectType=NP(c),f.preOffsetY=0,f.offsetY=0,d&&(l.textMask=Bx.call(v(l),l.textObject,v(l))),l.addChildrenMap("background",u),l.addChildrenMap("text",c),l}return d(i,e),u(i,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy();}this.lines=void 0;}m(f(i.prototype),"destroy",this).call(this,t);}}},{key:"setClampMode",value:function(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}},{key:"textLineHeight",get:function(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i;}this._textLineHeight=t;}return this._textLineHeight}},{key:"textLineSpacing",get:function(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0;}this._textLineSpacing=t;}return this._textLineSpacing}},{key:"visibleLinesCount",get:function(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(JP.call(this,this._textObjectRealHeight))),this._visibleLinesCount}},{key:"topTextOY",get:function(){return 0}},{key:"bottomTextOY",get:function(){return -this.textVisibleHeight}},{key:"textHeight",get:function(){return void 0===this._textHeight&&(this._textHeight=qP.call(this,this.linesCount)),this._textHeight}},{key:"textObjectHeight",get:function(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}},{key:"textVisibleHeight",get:function(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t;}return this._textVisibleHeight}},{key:"textOYExceedTop",value:function(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}},{key:"textOYExeceedBottom",value:function(t){return void 0===t&&(t=this.textOY),t<this.bottomTextOY}},{key:"textOY",get:function(){return this._textOY},set:function(t){var e=this.topTextOY,i=this.bottomTextOY,n=this.textOYExceedTop(t),s=this.textOYExeceedBottom(t);this.clampTextOY&&(this.visibleLinesCount>this.linesCount?t=0:n?t=e:s&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,s&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=s;}},{key:"setTextOY",value:function(t){return this.textOY=t,this}},{key:"t",get:function(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t},set:function(t){this.textOY=-this.textVisibleHeight*t;}},{key:"setTextOYByPercentage",value:function(t){return this.t=t,this}}]),i}(Vm),aT=function(t){return t.add.text(0,0,"")};Object.assign(oT.prototype,iT);var hT={scrollToLine:function(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine:function(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}},lT=Phaser.Utils.Objects.GetValue,uT=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={});var r=lT(n,"text",void 0),o=lT(n,"textWidth",void 0),a=lT(n,"textHeight",void 0),l=lT(n,"textCrop",!!r.setCrop),u=lT(n,"textMask",!l),c=lT(n,"content",""),d=new oT(e,{width:o,height:a,text:r,textMask:u,textCrop:l&&!u,content:c,clamplTextOY:lT(n,"clamplChildOY",!1),alwaysScrollable:lT(n,"alwaysScrollable",!1)});e.add.existing(d),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e;}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}});}(d),n.scrollMode=0,n.type="rexTextArea",n.child={gameObject:d,expandWidth:void 0===o,expandHeight:void 0===a};var f=lT(n,"space",void 0);return f&&(f.child=lT(f,"text",0)),(s=t(this,i,[e,n])).addChildrenMap("text",r),s}return d(i,e),u(i,[{key:"text",get:function(){return this.childrenMap.child.text}},{key:"lineHeight",get:function(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}},{key:"lineIndex",get:function(){return Math.floor(-this.childOY/this.lineHeight)}},{key:"linesCount",get:function(){return this.childrenMap.child.linesCount}},{key:"contentHeight",get:function(){return this.childrenMap.child.textHeight}}]),i}(HP);Object.assign(uT.prototype,{setText:function(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText:function(t){return this.setText(this.text+t),this}},hT);var cT=Phaser.Utils.Objects.GetValue,dT=function(t,e,i){e=e?R(e):{};var n=cT(i,"background",ZC),s=cT(i,"text",tw),r=cT(i,"track",ZC),o=cT(i,"thumb",ZC);n?e.background=n(t,e.background):delete e.background,s?e.text=s(t,e.text):delete e.text;var a=e.slider;!1!==a&&(void 0===a&&(a={}),r?a.track=r(t,a.track):delete a.track,o?a.thumb=o(t,a.thumb):delete a.thumb,e.slider=a);var h=new uT(t,e);return t.add.existing(h),h},fT=Phaser.Utils.Objects.GetValue,pT=Phaser.Utils.Objects.GetValue,vT=function(e){function i(e,n,s){var r;h(this,i),n=n?R(n):{},void 0===s&&(s={});var o=pT(s,"background",ZC);o?n.background=o(e,n.background):delete n.background,n.title=_S(e,n.title,s.title),n.content=function(t,e,i){var n,s=fT(e,"$type");void 0===s&&e&&(e.hasOwnProperty("slider")||e.hasOwnProperty("scroller"))&&(s="textarea"),n="textarea"===s?new dT(t,e,i):new _S(t,e,i);return t.add.existing(n),n}(e,n.content,s.content),n.content instanceof uT&&Jl(n,"height")&&!Jl(n,"proportion.content")&&Q(n,"proportion.content",1);var a=n.button,l=n.buttonA||a,u=n.buttonB||a,c=n.buttonMode;void 0===c&&(c=l&&u?2:l?1:0);var d=s.button,f=s.buttonA||d,p=s.buttonB||d;switch(c){case 2:n.actions=[_S(e,l,f),_S(e,u,p)];break;case 1:n.actions=[_S(e,l,f)];break;case 0:break;default:n.actions=[];}var g=n.choice;g&&(n.choices=[]),(r=t(this,i,[e,n])).type="rexConfirmDialog",r.buttonMode=c,r.defaultActionConfig=a,r.defaultActionButtonCreator=d,r.defaultChoiceConfig=g,r.defaultChoiceCreator=s.choice;var y=r.childrenMap.actions;return r.addChildrenMap("buttonA",y?y[0]:null),r.addChildrenMap("buttonB",y?y[1]:null),VS.call(v(r)),r.setConfirmButtonIndex(pT(n,"confirmButtonIndex",0)),r.setCancelButtonIndex(pT(n,"cancelButtonIndex",1)),r}return d(i,e),u(i)}(TS);Object.assign(vT.prototype,IS),E.register("confirmDialog",(function(t,e){var i=new vT(this.scene,t,e);return this.scene.add.existing(i),i})),Q(window,"RexPlugins.UI.ConfirmDialog",vT);var gT=Phaser.Utils.Objects.GetValue,yT=function(t,e){var i=e.dialog,n=!i;if(n){var s=e.style;s.buttonMode=2,i=new vT(t,s,e.creators),t.add.existing(i);}i.setConfirmButtonIndex(gT(e,"confirmButtonIndex",0)).setCancelButtonIndex(gT(e,"cancelButtonIndex",1)).resetDisplayContent(e.content).layout(),n&&e.onCreateDialog&&e.onCreateDialog(i);var r=e.modal;r&&!r.hasOwnProperty("destroy")&&(r.destroy=n);var o=e.confirm,a=e.cancel,h=e.confirmScope,l=e.cancelScope;o&&i.once("confirm",o,h),a&&i.once("cancel",a,l);return i.modal(r,(function(t){i.off("confirm",o,h),i.off("cancel",a,l);})),i},mT=function(e){function i(e,n){var s;return h(this,i),void 0===n&&(n={}),(s=t(this,i,[e,n])).type="rexConfirmActionButton",s.setConfirmDialogEnable(),s.confirmActionConfig=ni(n.confirmDialog||{}),n.confirm&&s.setConfirmCallback(n.confirm,n.confirmScope),n.cancel&&s.setCancelCallback(n.cancel,n.cancelScope),s.onClickCallback=function(){if(this.confirmDialogEnable){if(this.confirmDialog)return;this.confirmDialog=yT(e,this.confirmActionConfig),this.confirmDialog.once("destroy",(function(){this.confirmDialog=void 0;}),this);}else this.runConfirmCallback();},s.onClick(s.onClickCallback,v(s)),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.confirmDialog&&this.confirmDialog.destroy(),m(f(i.prototype),"destroy",this).call(this,t),this.confirmActionConfig=void 0,this.onClickCallback=void 0,this.confirmDialog=void 0);}},{key:"setConfirmCallback",value:function(t,e){return this.confirmActionConfig.confirm=t,this.confirmActionConfig.confirmScope=e,this}},{key:"setCancelCallback",value:function(t,e){return this.confirmActionConfig.cancel=t,this.confirmActionConfig.cancelScope=e,this}},{key:"setConfirmDialogContent",value:function(t){return this.confirmActionConfig.content=t,this}},{key:"setConfitmDialogStyle",value:function(t){return this.confirmActionConfig.style=t,this}},{key:"setConfitmDialogModalConfig",value:function(t){return this.confirmActionConfig.modal=t,this}},{key:"setConfirmDialogEnable",value:function(t){return void 0===t&&(t=!0),this.confirmDialogEnable=t,this}},{key:"runConfirmCallback",value:function(){var t=this.confirmActionConfig.confirm,e=this.confirmActionConfig.confirmScope;return t&&t.call(e),this}}]),i}(Ix);E.register("confirmActionButton",(function(t){var e=new mT(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.ConfirmActionButton",mT);var kT=function(t,e){if(t){var i=$d(t);i&&i.remove(t,e);}},bT=Phaser.Utils.Objects.GetValue,xT=function(t,e,i){var n=bT(t,"proportion.".concat(e),i.proportion),s=bT(t,"align.".concat(e),"center"),r=bT(t,"space.".concat(e),void 0);if("number"==typeof r&&i.paddingKey){var o=r;(r={})[i.paddingKey]=o;}return {proportion:n,align:s,padding:r,expand:bT(t,"expand.".concat(e),!0)}},CT=function(t){return xT(t,"header",{proportion:0,paddingKey:"bottom"})},wT=function(t){return xT(t,"leftSide",{proportion:0,paddingKey:"right"})},ST=function(t){return xT(t,"content",{proportion:1})},PT=function(t){return xT(t,"rightSide",{proportion:0,paddingKey:"left"})},TT=function(t){return xT(t,"footer",{proportion:0,paddingKey:"top"})},OT=function(t,e){var i=new Ex(t,{orientation:e});return t.add.existing(i),i},MT=Phaser.Utils.Objects.GetValue,ET=[function(t){var e=this.scene,i=t.header;i&&this.add(i,CT(t));var n=OT(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var s=t.leftSide;s&&n.add(s,wT(t));var r=t.content;r&&n.add(r,ST(t));var o=t.rightSide;o&&n.add(o,PT(t));var a=t.footer;a&&this.add(a,TT(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,CT(t));var n=OT(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var s=t.leftSide;s&&n.add(s,wT(t));var r=OT(e,1);n.add(r,{proportion:1,align:"center",padding:0,expand:!0});var o=OT(e,0);r.add(o,{proportion:1,align:"center",padding:0,expand:!0});var a=t.content;a&&o.add(a,ST(t));var h=t.rightSide;h&&o.add(h,PT(t));var l=t.footer;l&&r.add(l,TT(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,CT(t));var n=OT(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var s=OT(e,1);n.add(s,{proportion:1,align:"center",padding:0,expand:!0});var r=OT(e,0);s.add(r,{proportion:1,align:"center",padding:0,expand:!0});var o=t.leftSide;o&&r.add(o,wT(t));var a=t.content;a&&r.add(a,ST(t));var h=t.footer;h&&s.add(h,TT(t));var l=t.rightSide;l&&n.add(l,PT(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,CT(t));var n=OT(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var s=t.leftSide;s&&n.add(s,wT(t));var r=OT(e,1);n.add(r,{proportion:1,align:"center",padding:0,expand:!0});var o=t.content;o&&r.add(o,ST(t));var a=t.footer;a&&r.add(a,TT(t));var h=t.rightSide;h&&n.add(h,PT(t));}],_T={FFF:0,LFF:1,FFR:2,LFR:3},RT=function(e){function i(e,n){var s;return h(this,i),void 0===n&&(n={}),n.orientation=1,(s=t(this,i,[e,n])).type="rexHolyGrail",s.build(n),s}return d(i,e),u(i)}(Ex),LT={build:function(t){void 0===t&&(t={});var e=t.background,i=t.header,n=t.leftSide,s=t.content,r=t.rightSide,o=t.footer;kT(e),kT(i),kT(n),kT(s),kT(r),kT(o),this.clear(!0),e&&this.addBackground(e);var a=MT(t,"layoutMode",0);return "string"==typeof a&&(a=_T[a.toUpperCase()]),(ET[a]||ET[0]).call(this,t),this.addChildrenMap("background",e),this.addChildrenMap("header",i),this.addChildrenMap("leftSide",n),this.addChildrenMap("content",s),this.addChildrenMap("rightSide",r),this.addChildrenMap("footer",o),this}};Object.assign(RT.prototype,LT),E.register("holyGrail",(function(t){var e=new RT(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.HolyGrail",RT);var BT={getButtonsSizer:function(t){return this.childrenMap["".concat(t,"ButtonsSizer")]},getButton:function(t,e){var i=this.getButtonsSizer(t);return i?i.getButton(e):void 0},setButtonEnable:function(t,e,i){return this.getButtonsSizer(t).setButtonEnable(e,i),this},setLeftButtonEnable:function(t,e){return this.childrenMap.leftButtonsSizer.setButtonEnable(t,e),this},setRightButtonEnable:function(t,e){return this.childrenMap.rightButtonsSizer.setButtonEnable(t,e),this},setTopButtonEnable:function(t,e){return this.childrenMap.topButtonsSizer.setButtonEnable(t,e),this},setBottomButtonEnable:function(t,e){return this.childrenMap.bottomButtonsSizer.setButtonEnable(t,e),this},toggleButtonEnable:function(t,e){return this.getButtonsSizer(t).toggleButtonEnable(e),this},toggleLeftButtonEnable:function(t){return this.childrenMap.leftButtonsSizer.toggleButtonEnable(t),this},toggleRightButtonEnable:function(t){return this.childrenMap.rightButtonsSizer.toggleButtonEnable(t),this},toggleTopButtonEnable:function(t){return this.childrenMap.topButtonsSizer.toggleButtonEnable(t),this},toggleBottomButtonEnable:function(t){return this.childrenMap.bottomButtonsSizer.toggleButtonEnable(t),this},getButtonEnable:function(t,e){return this.getButtonsSizer(t).getButtonEnable(e)},getLeftButtonEnable:function(t){return this.childrenMap.leftButtonsSizer.getButtonEnable(t)},getRightButtonEnable:function(t){return this.childrenMap.rightButtonsSizer.getButtonEnable(t)},getTopButtonEnable:function(t){return this.childrenMap.topButtonsSizer.getButtonEnable(t)},getBottomButtonEnable:function(t){return this.childrenMap.bottomButtonsSizer.getButtonEnable(t)},emitButtonClick:function(t,e){var i=this.getButtonsSizer(t);return i?(i.emitButtonClick(e),this):this},emitLeftButtonClick:function(t){return this.childrenMap.leftButtonsSizer.emitButtonClick(t),this},emitRightButtonClick:function(t){return this.childrenMap.rightButtonsSizer.emitButtonClick(t),this},emitTopButtonClick:function(t){return this.childrenMap.topButtonsSizer.emitButtonClick(t),this},emitBottomButtonClick:function(t){return this.childrenMap.bottomButtonsSizer.emitButtonClick(t),this},getLeftButton:function(t){return this.childrenMap.leftButtonsSizer.getButton(t)},getRightButton:function(t){return this.childrenMap.rightButtonsSizer.getButton(t)},getTopButton:function(t){return this.childrenMap.topButtonsSizer.getButton(t)},getBottomButton:function(t){return this.childrenMap.bottomButtonsSizer.getButton(t)},showButton:function(t,e){return ng(this.getButton(t,e)),this},showLeftButton:function(t){return ng(this.getLeftButton(t)),this},showRightButton:function(t){return ng(this.getRightButton(t)),this},showTopButton:function(t){return ng(this.getTopButton(t)),this},showBottomButton:function(t){return ng(this.getBottomButton(t)),this},hideButton:function(t,e){return sg(this.getButton(t,e)),this},hideLeftButton:function(t){return sg(this.getLeftButton(t)),this},hideRightButton:function(t){return sg(this.getRightButton(t)),this},hideTopButton:function(t){return sg(this.getTopButton(t)),this},hideBottomButton:function(t){return sg(this.getBottomButton(t)),this},addButton:function(t,e){return this.getButtonsSizer(t).addButton(e),this},addLeftButton:function(t){return this.addButton("left",t),this},addRightButton:function(t){return this.addButton("right",t),this},addTopButton:function(t){return this.addButton("top",t),this},removeButton:function(t,e,i){return this.getButtonsSizer(t).removeButton(e,i),this},removeLeftButton:function(t,e){return this.removeButton("left",t,e),this},removeRightButton:function(t,e){return this.removeButton("right",t,e),this},removeTopButton:function(t,e){return this.removeButton("top",t,e),this},removeBottomButton:function(t,e){return this.removeButton("bottom",t,e),this},clearButtons:function(t,e){return this.getButtonsSizer(t).clearButtons(e),this},clearLeftButtons:function(t){return this.clearButtons("left",t),this},clearRightButtons:function(t){return this.clearButtons("right",t),this},clearTopButtons:function(t){return this.clearButtons("top",t),this},clearBottomButtonss:function(t){return this.clearButtons("bottom",t),this},forEachButton:function(t,e,i){return this.getButtonsSizer(t).forEachButtton(e,i),this},forEachLeftButton:function(t,e){return this.childrenMap.leftButtonsSizer.forEachButtton(t,e),this},forEachRightButton:function(t,e){return this.childrenMap.rightButtonsSizer.forEachButtton(t,e),this},forEachTopButton:function(t,e){return this.childrenMap.topButtonsSizer.forEachButtton(t,e),this},forEachBottomButton:function(t,e){return this.childrenMap.bottomButtonsSizer.forEachButtton(t,e),this}},DT=Phaser.Utils.Objects.GetValue,IT=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),n.column=3,n.row=3,n.columnProportions=[0,0,0],n.rowProportions=[0,0,0];var r=DT(n,"expand.panel",!1);r&&(n.columnProportions[1]=1,n.rowProportions[1]=1),(s=t(this,i,[e,n])).type="rexTabs",s.eventEmitter=DT(n,"eventEmitter",v(s));var o,a,l,u,c=DT(n,"background",void 0),d=DT(n,"panel",void 0),f=DT(n,"leftButtons",void 0),p=DT(n,"leftButtonsBackground",void 0),g=DT(n,"rightButtons",void 0),y=DT(n,"rightButtonsBackground",void 0),m=DT(n,"topButtons",void 0),k=DT(n,"topButtonsBackground",void 0),b=DT(n,"bottomButtons",void 0),x=DT(n,"bottomButtonsBackground",void 0),C=DT(n,"click",void 0);if(c&&s.addBackground(c),d&&s.add(d,{column:1,row:1,expand:r}),f){var w=DT(n,"space.leftButtonsOffset",0),S=DT(n,"space.leftButton",0),P=DT(n,"expand.leftButtons",!1),T=DT(n,"align.leftButtons","top");o=new iS(e,{groupName:"left",background:p,buttons:f,orientation:"y",space:{item:S},expand:P,click:C,eventEmitter:s.eventEmitter}),s.add(o,{column:0,row:1,align:T,padding:{top:w},expand:P});}if(g){var O=DT(n,"space.rightButtonsOffset",0),M=DT(n,"space.rightButton",0),E=DT(n,"expand.rightButtons",!1),_=DT(n,"align.rightButtons","top");a=new iS(e,{groupName:"right",background:y,buttons:g,orientation:"y",space:{item:M},expand:E,click:C,eventEmitter:s.eventEmitter}),s.add(a,{column:2,row:1,align:_,padding:{top:O},expand:E});}if(m){var R=DT(n,"space.topButtonsOffset",0),L=DT(n,"space.topButton",0),B=DT(n,"expand.topButtons",!1),D=DT(n,"align.topButtons","left");l=new iS(e,{groupName:"top",background:k,buttons:m,orientation:"x",space:{item:L},expand:B,align:DT(n,"align.topButtons",void 0),click:C,eventEmitter:s.eventEmitter}),s.add(l,{column:1,row:0,align:D,padding:{left:R},expand:B});}if(b){var I=DT(n,"space.bottomButtonsOffset",0),j=DT(n,"space.bottomButton",0),z=DT(n,"expand.bottomButtons",!1),A=DT(n,"align.bottomButtons","left");u=new iS(e,{groupName:"bottom",background:x,buttons:b,orientation:"x",space:{item:j},expand:z,align:DT(n,"align.bottomButtons",void 0),click:C,eventEmitter:s.eventEmitter}),s.add(u,{column:1,row:2,align:A,padding:{left:I},expand:z});}return s.addChildrenMap("background",c),s.addChildrenMap("panel",d),s.addChildrenMap("leftButtons",f),s.addChildrenMap("rightButtons",g),s.addChildrenMap("topButtons",m),s.addChildrenMap("bottomButtons",b),s.addChildrenMap("leftButtonsSizer",o),s.addChildrenMap("rightButtonsSizer",a),s.addChildrenMap("topButtonsSizer",l),s.addChildrenMap("bottomButtonsSizer",u),s}return d(i,e),u(i)}(LC);Object.assign(IT.prototype,BT),E.register("tabs",(function(t){var e=new IT(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Tabs",IT),E.register("slider",(function(t){var e=new gP(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Slider",gP);var jT=function(){function t(e,i){h(this,t),this.container=null,this._deltaHeight=0,this.setParent(e);}return u(t,[{key:"setParent",value:function(t){this.parent=t,this.parentContainer=t.getParentContainer();}},{key:"destroy",value:function(t){void 0===t&&(t=!1),t||this.destroyContainer(),this.deltaHeight=0,this.data=void 0,this.container=null,this.parent=void 0,this.parentContainer=void 0;}},{key:"table",get:function(){return this.parent}},{key:"scrollMode",get:function(){return this.parentContainer.scrollMode}},{key:"colIndx",get:function(){return this.parent.cellIndxeToColIndex(this.index)}},{key:"rowIndx",get:function(){return this.parent.cellIndxeToRowIndex(this.index)}},{key:"getContainer",value:function(){return this.container}},{key:"setContainer",value:function(t){return t?(this.container&&this.container.destroy(),this.container=t,this.parentContainer.add(t),this):(this.destroyContainer(),this)}},{key:"destroyContainer",value:function(){return this.container&&(this.container.destroy(),this.container=null),this}},{key:"popContainer",value:function(){if(this.container){var t=this.container;return this.container=null,this.parentContainer.remove(t),t}return null}},{key:"setXY",value:function(t,e){return this.container&&this.parentContainer.setChildLocalPosition(this.container,t,e),this}},{key:"setCellContainerAlign",value:function(t){return "string"==typeof t&&(t=rp[t]),this.cellContainerAlign=t,this}},{key:"deltaHeight",get:function(){return this._deltaHeight},set:function(t){null==t&&(t=0);var e=this.parent;0===this._deltaHeight&&0!==t?e.nonZeroDeltaHeightCount++:0!==this._deltaHeight&&0===t&&e.nonZeroDeltaHeightCount--;var i=this._deltaHeight!==t;if(this._deltaHeight=t,i){e.resetTotalRowsHeight();var n=0===this.scrollMode?"cellheightchange":"cellwidthchange";this.parentContainer.emit(n,this,this.container,this.parentContainer);}}},{key:"deltaWidth",get:function(){return this.deltaHeight},set:function(t){this.deltaHeight=t;}},{key:"setDeltaHeight",value:function(t){return this.deltaHeight=t,this}},{key:"setDeltaWidth",value:function(t){return this.deltaHeight=t,this}},{key:"height",get:function(){return 0===this.scrollMode?this.deltaHeight+this.parent.defaultCellHeight:this.parent.defaultCellWidth},set:function(t){1!==this.scrollMode&&this.setDeltaHeight(t-this.parent.defaultCellHeight);}},{key:"setHeight",value:function(t){return this.height=t,this}},{key:"width",get:function(){return 0===this.scrollMode?this.parent.defaultCellWidth:this.deltaHeight+this.parent.defaultCellHeight},set:function(t){0!==this.scrollMode&&this.setDeltaHeight(t-this.parent.defaultCellHeight);}},{key:"setWidth",value:function(t){return this.width=t,this}},{key:"scene",get:function(){return this.parentContainer.scene}}]),t}();Object.assign(jT.prototype,Pt);var zT=Phaser.Utils.Objects.GetValue,AT=Phaser.Utils.Array.SpliceOne,FT=function(){function t(e,i){h(this,t),this.parent=e,this.cells=[],this.cellPool=new at,this.resetFromJSON(i);}return u(t,[{key:"resetFromJSON",value:function(t){void 0===t&&(t={}),this.colCount=void 0,this.nonZeroDeltaHeightCount=0,this.resetTotalRowsHeight();var e=t.cellHeight;void 0===e&&(e=30);var i=t.cellWidth;return void 0===i&&(i=30),this.setDefaultCellHeight(e),this.setDefaultCellWidth(i),this.initCells(zT(t,"cellsCount",0)),this.setColumnCount(zT(t,"columns",1)),this}},{key:"destroy",value:function(t){this.cellPool.destroy(),this.cells=void 0,this.parent=void 0;}},{key:"defaultCellHeightMode",get:function(){return 0===this.nonZeroDeltaHeightCount}},{key:"setDefaultCellHeight",value:function(t){return this.defaultCellHeight=t,this}},{key:"setDefaultCellWidth",value:function(t){return this.defaultCellWidth=t,this}},{key:"initCells",value:function(t){var e=this.cells;e.length=t;for(var i=0;i<t;i++)e[i]=null;return this}},{key:"insertNewCells",value:function(t,e){var i=this.cells;if(t===i.length){var n=t+e;i.legth=n;for(var s=t;s<n;s++)i[s]=null;}else {var r,o=[];o.length=e;for(s=0;s<e;s++)o[s]=null;(r=this.cells).splice.apply(r,[t,0].concat(o));}return this.resetTotalRowsHeight(),this}},{key:"removeCells",value:function(t,e){for(var i=t+e,n=t;n<i;n++)this.freeCell(n);return i===this.cells.length?this.cells.length=t:(1===e?AT(this.cells,t):this.cells.splice(t,e),this.buildCellIndex(t)),this.resetTotalRowsHeight(),this}},{key:"setColumnCount",value:function(t){return this.colCount=t,this.resetTotalRowsHeight(),this}},{key:"rowCount",get:function(){return Math.ceil(this.cells.length/this.colCount)}},{key:"cellsCount",get:function(){return this.cells.length}},{key:"isValidCellIdx",value:function(t){return t>=0&&t<this.cells.length}},{key:"heightToRowIndex",value:function(t,e){if(void 0===e&&(e=0),0===t)return 0;if(this.defaultCellHeightMode){var i=t/this.defaultCellHeight;if(1===e)i=Math.ceil(i);else i=Math.floor(i);return i}var n,s=this.rowCount,r=t;for(i=0;;){if(n=i>=0&&i<s,!((r-=this.getRowHeight(i))>0&&n)){if(0===r)return 2===e&&(i+=1),i;if(1===e){var o=i;(n=(i+=1)>=0&&i<s)||(i=o);}return i}i+=1;}}},{key:"widthToColIndex",value:function(t,e){if(0===t)return 0;var i=t/this.defaultCellWidth;return i=e?Math.ceil(i):Math.floor(i)}},{key:"colRowToCellIndex",value:function(t,e){return t>=this.colCount?null:e*this.colCount+t}},{key:"rowIndexToHeight",value:function(t,e){if(this.defaultCellHeightMode)return (e-t+1)*this.defaultCellHeight;for(var i=0,n=t;n<=e;n++)i+=this.getRowHeight(n);return i}},{key:"colIndexToWidth",value:function(t,e){return (e-t+1)*this.defaultCellWidth}},{key:"getRowHeight",value:function(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,n=0,s=0;s<e;s++)n<(i=this.getCellHeight(this.colRowToCellIndex(s,t)))&&(n=i);return n}},{key:"getColWidth",value:function(t){return this.defaultCellWidth}},{key:"getCellHeight",value:function(t){if(!this.isValidCellIdx(t))return 0;var e;if(this.defaultCellHeightMode)e=this.defaultCellHeight;else {var i=this.getCell(t,!1),n=i?i.deltaHeight:0;e=this.defaultCellHeight+n;}return e}},{key:"resetTotalRowsHeight",value:function(){this._totalRowsHeight=null;}},{key:"totalRowsHeight",get:function(){return null===this._totalRowsHeight&&(this._totalRowsHeight=this.rowIndexToHeight(0,this.rowCount-1)),this._totalRowsHeight}},{key:"totalColumnWidth",get:function(){return this.colCount*this.defaultCellWidth}},{key:"cellIndxeToColIndex",value:function(t){return t%this.colCount}},{key:"cellIndxeToRowIndex",value:function(t){return Math.floor(t/this.colCount)}},{key:"getCell",value:function(t,e){if(!this.isValidCellIdx(t))return null;if(void 0===e&&(e=!0),null===this.cells[t]&&e){var i=this.newCell(t);this.cells[t]=i;}return this.cells[t]}},{key:"newCell",value:function(t){var e=this.cellPool.pop();return null===e?e=new jT(this):e.setParent(this),e.index=t,e}},{key:"buildCellIndex",value:function(t){void 0===t&&(t=0);for(var e,i=this.cells,n=t,s=i.length;n<s;n++)(e=i[n])&&(e.index=n);return this}},{key:"getParentContainer",value:function(){return this.parent}},{key:"freeCell",value:function(t){return "number"==typeof t&&(t=this.cells[t]),t?(t.destroy(),this.cellPool.push(t),this):this}}]),t}(),WT=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask},VT=Phaser.Geom.Intersects.RectangleToRectangle,YT=Phaser.Geom.Rectangle.Overlaps,GT=function(t){if(!t.displayList)return !1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return !0}return !1}return t.visible}},XT=function(t,e){var i=e.top,n=e.bottom,s=e.left,r=e.right,o=0;return o+=t.contains(s,i)?1:0,o+=t.contains(s,n)?1:0,o+=t.contains(r,i)?1:0,o+=t.contains(r,n)?1:0},HT=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0));},UT=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0));},NT=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1));},KT=Phaser.Utils.Objects.GetValue,JT={update:0,everyTick:1},qT={setupChildrenMask:function(t){return !1===t||(this.setMaskUpdateMode(KT(t,"updateMode",0)),this.enableChildrenMask(KT(t,"padding",0)),this.setMaskLayer(KT(t,"layer",void 0)),this.startMaskUpdate()),this},destroyChildrenMask:function(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this):this},setMaskUpdateMode:function(t){return "string"==typeof t&&(t=JT[t]),this.maskUpdateMode=t,this},startMaskUpdate:function(){this.scene.game.events.on("poststep",this.maskChildren,this);},stopMaskUpdate:function(){this.scene.game.events.off("poststep",this.maskChildren,this);},enableChildrenMask:function(t){var e=Bx.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag:function(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer:function(t){return this.maskLayer=t,this},maskChildren:function(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function(t,e,i){if(e){void 0===i&&(i=t.getAllChildren());for(var n,s,r=t.getBounds(),o=WT(e),a=0,h=i.length;a<h;a++)if((n=i[a])!==o&&GT(n))if(n.getBounds)switch(s=n.getBounds(s),XT(r,s)){case 4:HT(t,n);break;case 0:VT(r,s)||YT(r,s)?UT(t,n,e):NT(t,n);break;default:UT(t,n,e);}else UT(t,n,e);}}(this,this.childrenMask),0===this.maskUpdateMode&&(this.maskChildrenFlag=!1),this):this},layoutChildrenMask:function(){if(!this.childrenMask)return this;var t=WT(this.childrenMask);return t.setPosition().resize(),this.resetChildPositionState(t),this}},ZT=function(t){var e,i=null;((e=t.getContainer())?(i=e,t.popContainer()):this.cellContainersPool&&null!==(i=this.cellContainersPool.getFirstDead())&&i.setActive(!0).setVisible(!0),this.emit("cellvisible",t,i,this),this.cellContainersPool)&&((e=t.getContainer())?null===i?this.cellContainersPool.add(e):i!==e&&(this.cellContainersPool.add(e),this.cellContainersPool.killAndHide(i)):null!==i&&this.cellContainersPool.killAndHide(i));},$T=function(t){if(this.emit("cellinvisible",t),this.cellContainersPool){var e=t.popContainer();e&&this.cellContainersPool.killAndHide(e);}t.destroyContainer();},QT=function(){var t=this.preVisibleCells;this.preVisibleCells=this.visibleCells,this.visibleCells=t,this.visibleCells.clear();},tO=function(t,e){e-=this.y+this.topLeftY,t-=this.x+this.topLeftX;var i=this.tableOY-(0===this.scrollMode?e:t),n=this.tableOX-(0===this.scrollMode?t:e),s=this.table,r=s.heightToRowIndex(-i,0),o=s.widthToColIndex(-n),a=s.colRowToCellIndex(o,r);return null===a?null:this.isCellVisible(a)?a:null},eO=Phaser.Math.Clamp,iO={setTableOY:function(t){var e=this.table,i=this.topTableOY,n=this.bottomTableOY,s=t>this.topTableOY,r=t<this.bottomTableOY;this.clampTableOXY&&(e.rowCount<e.heightToRowIndex(this.instHeight,1)?t=0:s?t=i:r&&(t=n));return this._tableOY!==t&&(this._tableOY=t),s&&(this.execeedTopState||this.emit("execeedtop",this,t,i)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,n)),this.execeedBottomState=r,this},setTableOX:function(t){var e=this.table,i=this.leftTableOX,n=this.rightTableOX,s=t>this.leftTableOX,r=t<this.rightTableOX;this.clampTableOXY&&(e.colCount<e.widthToColIndex(this.instWidth,!0)?t=0:s?t=i:r&&(t=n));return this._tableOX!==t&&(this._tableOX=t),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,i)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,n)),this.execeedRightState=r,this},showCells:function(){if(0!==this.cellsCount){var t=this.table;this.startRowIndex=Math.max(t.heightToRowIndex(-this.tableOY,2),0);for(var e=this.startRowIndex,i=Math.max(t.widthToColIndex(-this.tableOX),0),n=i,s=t.colRowToCellIndex(n,e),r=this.bottomBound,o=this.rightBound,a=t.cellsCount-1,h=t.colCount-1,l=this.getCellTLX(n),u=l,c=this.getCellTLY(e);c<r&&s<=a;){if(this.table.isValidCellIdx(s)){var d,f,p=t.getCell(s,!0);if(this.visibleCells.set(p),this.preVisibleCells.contains(p)||this.showCell(p),0===this.scrollMode?(d=u,f=c):(d=c,f=u),null==p.cellContainerAlign)p.setXY(d,f);else {var v=p.getContainer();Ep(v,d,f,p.width,p.height,p.cellContainerAlign),p.setXY(v.x,v.y);}}u<o&&n<h?(u+=t.getColWidth(n),n+=1):(u=l,c+=t.getRowHeight(e),n=i,e+=1),s=t.colRowToCellIndex(n,e);}}},showCell:ZT,getCellTLX:function(t){var e=0===this.scrollMode?this.topLeftX:this.topLeftY;return this.tableOX+this.table.colIndexToWidth(0,t-1)+e},getCellTLY:function(t){var e=0===this.scrollMode?this.topLeftY:this.topLeftX;return this.tableOY+this.table.rowIndexToHeight(0,t-1)+e},hideCells:function(){var t=this.preVisibleCells,e=this.visibleCells;t.iterate((function(t){e.contains(t)||this.hideCell(t);}),this);},hideCell:$T,updateTable:function(t){return void 0===t&&(t=!1),t&&(QT.call(this),this.hideCells()),QT.call(this),this.showCells(),this.hideCells(),this.setMaskChildrenFlag(),this},isCellVisible:function(t){var e=this.table.getCell(t,!1);return e&&this.visibleCells.contains(e)},pointToCellIndex:tO,pointToCellContainer:function(t,e){var i=tO.call(this,t,e);if(null!==i)return this.getCellContainer(i)},eachVisibleCell:function(t,e){return this.visibleCells.each(t,e),this},iterateVisibleCell:function(t,e){return this.visibleCells.iterate(t,e),this},eachCell:function(t,e){return this.table.cells.slice().forEach(t,e),this},iterateCell:function(t,e){return this.table.cells.forEach(t,e),this},setCellsCount:function(t){var e=this.cellsCount;return e===t||(e>t?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return "object"===o(t)&&(t=t.index),void 0===e&&(e=1),e<=0||(t=eO(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"===o(t)&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,n=t,s=t+e;n<s;n++)(i=this.getCell(n,!1))&&(this.visibleCells.contains(i)&&($T.call(this,i),this.visibleCells.delete(i)),this.preVisibleCells.delete(i));return this.table.removeCells(t,e),this},setColumnCount:function(t){return this.table.colCount===t||this.table.setColumnCount(t),this},setGridSize:function(t,e){return this.setCellsCount(t*e),this.table.setColumnCount(t),this},updateVisibleCell:function(t){var e=this.table.getCell(t,!1);return e&&e.container?(ZT.call(this,e),this):this}};Object.assign(iO,qT);var nO=Phaser.GameObjects.Group,sO=Phaser.Structs.Set,rO=Phaser.Utils.Objects.GetValue,oO=function(e){function i(e,n,s,r,o,a){var l;h(this,i),void 0===a&&(a={}),(l=t(this,i,[e,n,s,r,o])).type="rexGridTable",l._tableOX=0,l._tableOY=0,l.visibleCells=new sO,l.preVisibleCells=new sO,l.execeedTopState=!1,l.execeedBottomState=!1,l.execeedLeftState=!1,l.execeedRightState=!1,rO(a,"reuseCellContainer",!1)&&(l.cellContainersPool=new nO(e));var u,c,d,f=rO(a,"cellVisibleCallback",null);if(null!==f){var p=rO(a,"cellVisibleCallbackScope",void 0);l.on("cellvisible",f,p);}if(null!==(f=rO(a,"cellInvisibleCallback",null))){p=rO(a,"cellInvisibleCallbackScope",void 0);l.on("cellinvisible",f,p);}rO(a,"enableLayer",!1)&&l.enableLayer(),l.setupChildrenMask(rO(a,"mask",void 0)),l.setScrollMode(rO(a,"scrollMode",0)),l.setClampMode(rO(a,"clamplTableOXY",!0));var g=0===l.scrollMode;(g?(u=a.cellWidth,c=a.cellHeight,d=a.columns):(u=a.cellHeight,c=a.cellWidth,d=rO(a,"rows",a.columns)),d||(d=1),l.expandCellSize=void 0===u,l.expandCellSize)&&(u=(r=g?l.width:l.height)/d);return a.cellWidth=u,a.cellHeight=c,a.columns=d,l.table=new FT(v(l),a),l.updateTable(),l}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.destroyChildrenMask(),this.table.destroy(t),this.table=void 0,this.cellContainersPool&&(this.cellContainersPool.destroy(!0),this.cellContainersPool=void 0),m(f(i.prototype),"destroy",this).call(this,t));}},{key:"setScrollMode",value:function(t){return "string"==typeof t&&(t=aO[t.toLowerCase()]),this.scrollMode=t,this}},{key:"setClampMode",value:function(t){return void 0===t&&(t=!0),this.clampTableOXY=t,this}},{key:"tableOY",get:function(){return this._tableOY},set:function(t){this.setTableOY(t).updateTable();}},{key:"tableOX",get:function(){return this._tableOX},set:function(t){this.setTableOX(t).updateTable();}},{key:"setTableOXY",value:function(t,e){return this.setTableOY(e).setTableOX(t),this}},{key:"addTableOY",value:function(t){return this.setTableOY(this.tableOY+t),this}},{key:"addTableOX",value:function(t){return this.setTableOX(this.tableOX+t),this}},{key:"addTableOXY",value:function(t,e){return this.addTableOY(e).addTableOX(t),this}},{key:"setTableOYByPercentage",value:function(t){return this.setTableOY(-this.tableVisibleHeight*t),this}},{key:"getTableOYPercentage",value:function(){var t=this.tableVisibleHeight;return 0===t?0:this.tableOY/-t}},{key:"setTableOXByPercentage",value:function(t){return this.setTableOX(-this.tableVisibleWidth*t),this}},{key:"getTableOXPercentage",value:function(){var t=this.tableVisibleWidth;return 0===t?0:this.tableOX/-t}},{key:"t",get:function(){return this.getTableOYPercentage()},set:function(t){this.setTableOYByPercentage(t).updateTable();}},{key:"s",get:function(){return this.getTableOXPercentage()},set:function(t){this.setTableOXByPercentage(t).updateTable();}},{key:"scrollToBottom",value:function(){if(this.t=1,0===this.t)return this;do{this.t=1;}while(1!==this.t);return this}},{key:"scrollToRow",value:function(t){this.scrollToBottom();var e=this.table.rowIndexToHeight(0,t-1);return this.setTableOY(-e).updateTable(),this}},{key:"scrollToNextRow",value:function(t){return void 0===t&&(t=1),this.scrollToRow(this.startRowIndex+t),this}},{key:"getCell",value:function(t){return this.table.getCell(t,!0)}},{key:"getCellContainer",value:function(t){var e,i=this.table.getCell(t,!1);return i&&(e=i.getContainer()),e}},{key:"cellsCount",get:function(){return this.table.cellsCount}},{key:"columnCount",get:function(){return this.table.colCount}},{key:"setCellHeight",value:function(t,e){return ("number"==typeof t?this.table.getCell(t,!0):t).height=e,this}},{key:"setCellWidth",value:function(t,e){return ("number"==typeof t?this.table.getCell(t,!0):t).width=e,this}},{key:"instHeight",get:function(){return 0===this.scrollMode?this.height:this.width}},{key:"instWidth",get:function(){return 0===this.scrollMode?this.width:this.height}},{key:"tableHeight",get:function(){return this.table.totalRowsHeight}},{key:"tableWidth",get:function(){return this.table.totalColumnWidth}},{key:"topTableOY",get:function(){return 0}},{key:"bottomTableOY",get:function(){return -this.tableVisibleHeight}},{key:"leftTableOX",get:function(){return 0}},{key:"rightTableOX",get:function(){return -this.tableVisibleWidth}},{key:"tableVisibleHeight",get:function(){var t=this.tableHeight-this.instHeight;return t<0&&(t=0),t}},{key:"tableVisibleWidth",get:function(){var t=this.tableWidth-this.instWidth;return t<0&&(t=0),t}},{key:"bottomLeftY",get:function(){return -this.displayHeight*this.originY+this.displayHeight}},{key:"topRightX",get:function(){return -this.displayWidth*this.originX+this.displayWidth}},{key:"topLeftX",get:function(){return -this.displayWidth*this.originX}},{key:"topLeftY",get:function(){return -this.displayHeight*this.originY}},{key:"bottomBound",get:function(){return 0===this.scrollMode?this.bottomLeftY:this.topRightX}},{key:"rightBound",get:function(){return 0===this.scrollMode?this.topRightX:this.bottomLeftY}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(m(f(i.prototype),"resize",this).call(this,t,e),this.expandCellSize&&this.table.setDefaultCellWidth(this.instWidth/this.table.colCount),this.updateTable(!0),this.layoutChildrenMask(),this.maskChildren()),this}}]),i}(ip);Object.assign(oO.prototype,iO);var aO={v:0,vertical:0,h:1,horizontal:1},hO=function(t){t.on("cellvisible",(function(t,e,i){var n=this.createCellContainerCallback,s=this.createCellContainerCallbackScope;t.item=this.items[t.index],t.items=this.items,(e=s?n.call(s,t,e,i):n(t,e,i))&&(null==t.cellContainerAlign&&e.setOrigin&&e.setOrigin(0),e.isRexSizer&&e.layout()),t.item=void 0,t.items=void 0,t.setContainer(e);}),this);},lO=function(t,e,i,n,s,r,o){var a;if(null!=(a=void 0===s?n:i.pointToCellIndex(n,s))){var h=i.getCellContainer(a);h&&t.emit(e,h,a,r,o);}},uO=function(t,e){t.on("pointerdown",(function(e,i,n,s){lO(this.eventEmitter,"cell.down",t,e.worldX,e.worldY,e,s);}),this).on("pointerup",(function(e,i,n,s){lO(this.eventEmitter,"cell.up",t,e.worldX,e.worldY,e,s);}),this);},cO=function(t,e){t.on("pointermove",dO,this).on("pointerover",dO,this).on("pointerout",fO,this);},dO=function(t,e,i,n){var s=this.childrenMap.child,r=s.pointToCellIndex(t.worldX,t.worldY);if(r!==s.input.lastOverCellIndex){var o=s.input.lastOverCellIndex;s.input.lastOverCellIndex=r,lO(this.eventEmitter,"cell.out",s,o,void 0,t,n),lO(this.eventEmitter,"cell.over",s,r,void 0,t,n);}},fO=function(t,e){var i=this.childrenMap.child,n=i.input.lastOverCellIndex;i.input.lastOverCellIndex=void 0,lO(this.eventEmitter,"cell.out",i,n,void 0,t,e);},pO=Phaser.Utils.Objects.GetValue,vO=function(t,e){var i=pO(e,"click",void 0);!1!==i&&(void 0===i&&(i={}),i.threshold=10,t._click=new wc(t,i),t._click.on("click",(function(t,e,i,n){lO(this.eventEmitter,"cell.click",e,i.worldX,i.worldY,i,n);}),this));},gO=Phaser.Utils.Objects.GetValue,yO=function(t,e){var i=gO(e,"tap",void 0);!1!==i&&(t._tap=new Ly(t,i),t._tap.on("tap",(function(t,e,i){var n="cell.".concat(t.tapsCount,"tap");lO(this.eventEmitter,n,t.gameObject,t.worldX,t.worldY,i);}),this));},mO=Phaser.Utils.Objects.GetValue,kO=function(t,e){var i=mO(e,"press",void 0);!1!==i&&(t._press=new zy(t,i),t._press.on("pressstart",(function(e,i,n){lO(this.eventEmitter,"cell.pressstart",t,e.worldX,e.worldY,n);}),this).on("pressend",(function(e,i,n){lO(this.eventEmitter,"cell.pressend",t,e.worldX,e.worldY,n);}),this));},bO=Phaser.Utils.Objects.GetValue,xO=function(t,e){var i=bO(e,"swipe",void 0);!1!==i&&(void 0===i&&(i={}),i.dir="4dir",t._swipe=new Qy(t,i),t._swipe.on("swipe",(function(e,i,n){var s=e.left?"left":e.right?"right":e.up?"up":"down";lO(this.eventEmitter,"cell.swipe".concat(s),t,e.worldX,e.worldY,n);}),this));},CO=function(t,e){t.setInteractive(),uO.call(this,t,e),cO.call(this,t,e),vO.call(this,t,e),yO.call(this,t,e),kO.call(this,t,e),xO.call(this,t,e);},wO=Phaser.Utils.Objects.GetValue,SO=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={});var r=GS(n),o=wO(n,"table",void 0);void 0===o&&(o={}),o.scrollMode=2===r?0:r,o.clamplTableOXY=wO(n,"clamplChildOY",!1);var a,l,u=wO(o,"width",void 0),c=wO(o,"height",void 0),d=new oO(e,0,0,u,c,o);e.add.existing(d),0===o.scrollMode?(a=void 0===u,l=void 0===c):(a=void 0===c,l=void 0===u),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.tableOY},set:function(e){t.tableOY=e;}}),Object.defineProperty(t,"childOX",{configurable:!0,get:function(){return t.tableOX},set:function(e){t.tableOX=e;}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTableOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTableOY}}),Object.defineProperty(t,"leftChildOX",{get:function(){return t.leftTableOX}}),Object.defineProperty(t,"rightChildOX",{get:function(){return t.rightTableOX}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.instHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.tableHeight}}),Object.defineProperty(t,"childVisibleWidth",{get:function(){return t.instWidth}}),Object.defineProperty(t,"childWidth",{get:function(){return t.tableWidth}});}(d),d._minWidth=void 0===u?0:void 0,d._minHeight=void 0===c?0:void 0,n.type="rexGridTable",n.child={gameObject:d,expandWidth:a,expandHeight:l};var f=wO(n,"space",void 0);f&&(f.child=wO(f,"table",0)),(s=t(this,i,[e,n])).addChildrenMap("table",d),s.addChildrenMap("tableLayer",d.maskLayer),s.eventEmitter=wO(n,"eventEmitter",v(s));var p=wO(n,"createCellContainerCallback",z),g=wO(n,"createCellContainerCallbackScope",void 0);s.setCreateCellContainerCallback(p,g),hO.call(v(s),d),s.resizeControllerFlag=!1;var y=0===r?"cellheightchange":"cellwidthchange";return d.on(y,(function(){this.resizeControllerFlag=!0;}),v(s)),wO(o,"interactive",!0)&&CO.call(v(s),d,o),s.setItems(wO(n,"items",[]),!1),e.game.events.on("poststep",s.onPostStep,v(s)),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.game.events.off("poststep",this.onPostStep,this),m(f(i.prototype),"destroy",this).call(this,t));}},{key:"setCreateCellContainerCallback",value:function(t,e){return this.createCellContainerCallback=t,this.createCellContainerCallbackScope=e,this}},{key:"refresh",value:function(){return this.setItems(this.items),this}},{key:"getCell",value:function(t){return this.childrenMap.child.getCell(t)}},{key:"getCellContainer",value:function(t){return this.childrenMap.child.getCellContainer(t)}},{key:"updateVisibleCell",value:function(t){return this.childrenMap.child.updateVisibleCell(t)}},{key:"onPostStep",value:function(){this.resizeControllerFlag&&(this.resizeController(),this.resizeControllerFlag=!1);}},{key:"startRowIndex",get:function(){return this.childrenMap.child.startRowIndex}}]),i}(HP),PO={setItems:function(t,e){this.items=void 0===t?[]:t,void 0===e&&(e=!0);var i=this.childrenMap.child;return i.setCellsCount(this.items.length),e&&(i.updateTable(!0),this.resizeController()),this}};Object.assign(SO.prototype,{scrollToRow:function(t){return this.childrenMap.child.scrollToRow(t),this},scrollToNextRow:function(t){return this.childrenMap.child.scrollToNextRow(t),this}},PO),E.register("gridTable",(function(t){var e=new SO(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.GridTable",SO);var TO=function(t,e){return t.sameOrientation?t.orientation=e.orientation:t.orientation=0===e.orientation?1:0,t},OO=function(t,e){t.popUp(TO(t.root.easeIn,t));},MO=function(t,e){t.scaleDown(TO(t.root.easeOut,t));},EO={setTransitInCallback:function(t){return void 0===t&&(t=OO),this.transitInCallback=t,this},setTransitOutCallback:function(t){return void 0===t&&(t=MO),this.transitOutCallback=t,this}},_O={delayCall:function(t,e,i){return this.timer=function(t,e,i,n,s){var r=go(t);return r.time.delayedCall(e,(function(){r.sys.events.once("postupdate",(function(){i.call(n,s);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.timer&&(this.timer.remove(!1),this.timer=void 0),this}},RO={expandSubMenu:function(t,e){var i;if((n=this.childrenMap.subMenu)&&n.parentButton===t)return this;this.collapseSubMenu(),i=this.root.toggleOrientation?0===this.orientation?1:0:this.orientation;var n=new this.constructor(this.scene,{items:e,orientation:i,space:this.space,createBackgroundCallback:this.root.createBackgroundCallback,createBackgroundCallbackScope:this.root.createBackgroundCallbackScope,createButtonCallback:this.root.createButtonCallback,createButtonCallbackScope:this.root.createButtonCallbackScope,easeIn:this.root.easeIn,easeOut:this.root.easeOut,_rootMenu:this.root,_parentMenu:this,_parentButton:t});return this.pin(n),this.childrenMap.subMenu=n,this.root.emit("expand",n,t,this),this},collapse:function(){var t=this.root;t.emit("collapse",this,this.parentButton,t);var e=t.easeOut.duration;return t.transitOutCallback(this,e),this.collapseSubMenu(),this.delayCall(e,this.destroy,this),this},collapseSubMenu:function(){var t=this.childrenMap.subMenu;return void 0===t||(this.childrenMap.subMenu=void 0,this.remove(t),t.collapse()),this}};Object.assign(RO,EO,_O);var LO=function(t,e){return "number"==typeof e&&(e={duration:e}),e.hasOwnProperty("orientation")&&void 0!==e.orientation?e.sameOrientation=Tx(e.orientation)===t.orientation:e.sameOrientation=!0,e.destroy=!1,e},BO=function(){var t=this.root,e=t.easeIn.duration;t.transitInCallback(this,e),this!==this.root&&this.delayCall(e,(function(){this.root.emit("popup.complete",this);}),this);},DO=Phaser.Utils.Objects.GetValue,IO=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),n.hasOwnProperty("orientation")||(n.orientation=1);var r=n._rootMenu,o=n._parentMenu,a=n._parentButton,l=DO(n,"popup",!0),u=DO(n,"items",void 0),c=DO(n,"createBackgroundCallback",void 0),d=DO(n,"createBackgroundCallbackScope",void 0);n.background=function(t,e,i,n){var s;return i&&(e.scene=t,s=n?i.call(n,e):i(e),e.scene=void 0),s}(e,u,c,d);var f=DO(n,"createButtonCallback",void 0),p=DO(n,"createButtonCallbackScope",void 0);if(n.buttons=function(t,e,i,n){var s,r,o=[];if(e&&i)for(var a=0,h=e.length;a<h;a++)(s=e[a]).scene=t,r=n?i.call(n,s,a,e):i(s,a,e),s.scene=void 0,o.push(r);return o}(e,u,f,p),(s=t(this,i,[e,n])).type="rexMenu",s.items=u,s.root=void 0===r?v(s):r,s.isRoot=s.root===v(s),s.parentMenu=o,s.parentButton=a,s.timer=void 0,s.isRoot){s.isPopUpMode=l;var g=n.bounds;void 0===g&&(g=ao(e)),s.bounds=g,s.subMenuSide=[s.y<g.centerY?FO:AO,s.x<g.centerX?zO:jO],void 0!==(C=DO(n,"subMenuSide",void 0))&&("string"==typeof C&&(C=WO[C]),s.subMenuSide[s.orientation]=C),s.toggleOrientation=DO(n,"toggleOrientation",!1),s.expandEventName=DO(n,"expandEvent","button.click"),s.easeIn=LO(v(s),DO(n,"easeIn",0)),s.easeOut=LO(v(s),DO(n,"easeOut",0)),s.setTransitInCallback(DO(n,"transitIn")),s.setTransitOutCallback(DO(n,"transitOut")),s.createBackgroundCallback=c,s.createBackgroundCallbackScope=d,s.createButtonCallback=f,s.createButtonCallbackScope=p,s.childrenKey=DO(n,"childrenKey","children"),s._isPassedEvent=!1,s.pointerDownOutsideCollapsing=DO(n,"pointerDownOutsideCollapsing",!0),s.pointerDownOutsideCollapsing&&e.input.on("pointerdown",s.onPointerDownOutside,v(s));}var y,m=0,k=0;if(!s.root.easeIn.sameOrientation){var b=TO(s.root.easeIn,v(s)).orientation,x=o?o.orientation:s.orientation,C=s.root.subMenuSide[x];0===b&&C===jO&&(m=1),1===b&&C===AO&&(k=1);}if(l&&s.setOrigin(m,k).layout(),!s.isRoot)switch(s.setScale(s.root.scaleX,s.root.scaleY),C=s.root.subMenuSide[o.orientation]){case jO:s.alignTop(a.top).alignRight(a.left);break;case zO:s.alignTop(a.top).alignLeft(a.right);break;case AO:s.alignLeft(a.left).alignBottom(a.top);break;case FO:s.alignLeft(a.left).alignTop(a.bottom);}return (y=v(s)).on(y.root.expandEventName,(function(t,e){if(!this._isPassedEvent){var i=this.root.childrenKey,n=this.items[e][i];n&&this.expandSubMenu(t,n);}}),y).on("button.click",(function(t,e,i,n){this!==this.root&&(this.root._isPassedEvent=!0,this.root.emit("button.click",t,e,i,n),this.root._isPassedEvent=!1);}),y).on("button.over",(function(t,e,i,n){this!==this.root&&(this.root._isPassedEvent=!0,this.root.emit("button.over",t,e,i,n),this.root._isPassedEvent=!1);}),y).on("button.out",(function(t,e,i,n){this!==this.root&&(this.root._isPassedEvent=!0,this.root.emit("button.out",t,e,i,n),this.root._isPassedEvent=!1);}),y),l&&(s.pushIntoBounds(s.root.bounds),BO.call(v(s))),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.isRoot&&this.pointerDownOutsideCollapsing&&this.scene.input.off("pointerdown",this.onPointerDownOutside,this),m(f(i.prototype),"destroy",this).call(this,t),this.removeDelayCall());}},{key:"isInTouching",value:function(t){return !!m(f(i.prototype),"isInTouching",this).call(this,t)||!!this.childrenMap.subMenu&&this.childrenMap.subMenu.isInTouching(t)}},{key:"onPointerDownOutside",value:function(t){this.isInTouching(t)||(this.isPopUpMode?this.collapse():this.collapseSubMenu());}}]),i}(iS),jO=2,zO=0,AO=3,FO=1,WO={up:AO,down:FO,left:jO,right:zO};Object.assign(IO.prototype,RO),E.register("menu",(function(t){var e=new IO(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Menu",IO);var VO={setWrapEnable:function(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback:function(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback:function(t){return this.listCreateBackgroundCallback=t,this},setButtonClickCallback:function(t){return this.listOnButtonClick=t,this},setButtonOverCallback:function(t){return this.listOnButtonOver=t,this},setButtonOutCallback:function(t){return this.listOnButtonOut=t,this},setListExpandDirection:function(t){return "string"==typeof t&&(t=YO[t]),this.listExpandDirection=t,this},setListEaseInDuration:function(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration:function(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback:function(t){return this.listTransitInCallback=t,this},settListTransitOutCallback:function(t){return this.listTransitOutCallback=t,this},setListBounds:function(t){return this.listBounds=t,this},setListWidth:function(t){return this.listWidth=t,this},setListHeight:function(t){return this.listHeight=t,this},setListSize:function(t,e){return this.setListWidth(t).setListHeight(e),this},setListAlignmentMode:function(t){return this.listAlignMode=t,this},setListAlignmentSide:function(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace:function(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable:function(t){return void 0===t&&(t=!0),this.listDraggable=t,this}},YO={down:0,up:1},GO=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var n=[],s=this.listCreateButtonCallback;if(s)for(var r=this.options,o=0,a=r.length;o<a;o++){var h=s.call(this,e,r[o],o,r);h&&(e.add.existing(h),n.push(h));}var l=this.listWidth;void 0===l&&(l="text"===this.listAlignMode?this.getElement("text").width:this.width);var u,c=this.listHeight;return u=this.listWrapEnable?new kS(e,{width:l,height:c,background:t,buttons:n,space:this.listSpace,draggable:this.listDraggable}):new iS(e,{width:l,height:c,orientation:"y",background:t,buttons:n,space:this.listSpace,draggable:this.listDraggable}),e.add.existing(u),u},XO=Phaser.Utils.Objects.GetValue,HO=function(t,e){var i=XO(e,"expandDirection",void 0);"string"==typeof i&&(i=UO[i]);var n,s,r,a,h,l,u=(r="alignTargetX",Jl(n=e,s="alignTarget")?wt(n,s):r&&Jl(n,r)?wt(n,r):a),c=XO(e,"alignTargetY",u),d=XO(e,"alignOffsetX",0),f=XO(e,"alignOffsetY",0),p=XO(e,"alignSide","").includes("right"),v=XO(e,"bounds"),g=0===i,y=!g&&!(1===i),m=p?1:0,k=g||y?0:1;t.setOrigin(m,k),h=p?u.getTopRight().x:u.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+d,l+f);var b=v;b||(b=ao(t.scene)),y&&t.getBottomLeft().y>b.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+f));},UO={down:0,up:1},NO=Phaser.Utils.Objects.GetValue,KO=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=function(t,e){kv(t,e,"y","Cubic");}),null==n.transitOut&&(n.transitOut=function(t,e){!function(t,e,i,n,s){void 0===n&&(n="Linear");var r={mode:0};switch(i){case 0:case"x":r.end={x:0};break;case 1:case"y":r.end={y:0};break;default:r.end=0;}r.duration=e,r.ease=n,void 0===s?s=new yv(t,r):s.resetFromJSON(r),s.restart();}(t,e,"y","Linear");}),n.manualClose=!0,n.clickOutsideClose=!0,n.destroy=!0,s=t(this,i,[e,n]),HO(e,n),e.isRexSizer&&e.layout();var r=NO(n,"touchOutsideClose",!1),o=NO(n,"anyTouchClose",!1);return o&&(r=!1),o?s.once("open",s.anyTouchClose,v(s)):r&&s.once("open",s.touchOutsideClose,v(s)),s.requestOpen(),s}return d(i,e),u(i,[{key:"shutdown",value:function(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),m(f(i.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&zg(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"onOpen",value:function(){this.emit("open",this.parent,this),m(f(i.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.parent,this),m(f(i.prototype),"onClose",this).call(this);}}]),i}(Sg),JO={focusNextButton:function(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;void 0===e?t=0:t=(e+1)%this.listPanel.getButtons().length;return this.emitButtonOver(t),this},focusPrevButton:function(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else {var i=this.listPanel.getButtons().length;t=(e-1+i)%i;}return this.emitButtonOver(t),this}},qO={openListPanel:function(){if(this.listPanel)return this;var t,e=GO.call(this);e.on("button.over",(function(t,i,n,s){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,n,s),this.emit("button.over",this,e,t,i,n,s);}),this).on("button.out",(function(t,i,n,s){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,n,s),this.emit("button.out",this,e,t,i,n,s);}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new KO(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds,anyTouchClose:!0}).on("open",(function(){e.on("button.click",(function(t,i,n,s){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,n,s),this.emit("button.click",this,e,t,i,n,s);}),this),this.emit("list.open",this,e);}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this);}),this);return this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(qO,VO,JO);var ZO=Phaser.Utils.Objects.GetValue,$O=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).type="rexDropDownList",s.timer=void 0,s.listPanel=void 0,s.currentOverIndex=void 0,s.setOptions(ZO(n,"options"));var r=ZO(n,"list");return s.setWrapEnable(ZO(r,"wrap",!1)),s.setCreateButtonCallback(ZO(r,"createButtonCallback")),s.setCreateListBackgroundCallback(ZO(r,"createBackgroundCallback")),s.setButtonClickCallback(ZO(r,"onButtonClick")),s.setButtonOverCallback(ZO(r,"onButtonOver")),s.setButtonOutCallback(ZO(r,"onButtonOut")),s.setListExpandDirection(ZO(r,"expandDirection")),s.setListEaseInDuration(ZO(r,"easeIn",500)),s.setListEaseOutDuration(ZO(r,"easeOut",100)),s.setListTransitInCallback(ZO(r,"transitIn")),s.settListTransitOutCallback(ZO(r,"transitOut")),s.setListSize(ZO(r,"width"),ZO(r,"height")),s.setListAlignmentMode(ZO(r,"alignParent","text")),s.setListAlignmentSide(ZO(r,"alignSide","")),s.setListBounds(ZO(r,"bounds")),s.setListSpace(ZO(r,"space")),s.setListDraggable(ZO(r,"draggable",!1)),s.setValueChangeCallback(ZO(n,"setValueCallback"),ZO(n,"setValueCallbackScope")),s.setValue(ZO(n,"value")),s.onClick(s.toggleListPanel,v(s)),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),m(f(i.prototype),"destroy",this).call(this,t));}},{key:"isOpened",get:function(){return !!this.listPanel}},{key:"setOptions",value:function(t){return void 0===t&&(t=[]),this.options=t,this}},{key:"setValueChangeCallback",value:function(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"value",get:function(){return this._value},set:function(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,n=this.valueChangeCallbackScope;i&&(n?i.call(n,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e);}}}]),i}(Ix);Object.assign($O.prototype,qO),E.register("dropDownList",(function(t){var e=new $O(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.DropDownList",$O);var QO=function(t,e,i){void 0===i&&(i={});var n=(e=e?R(e):{}).label||e.button,s=e.button||e.label;delete e.label,delete e.button;var r=i.label||i.button||i,o=i.button||i.label||i,a=hw(t,n,r);return a.list=e.list||{},a.list.createButtonCallback=function(t,e){var i=_S(t,s,o).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i},a.list.onButtonOver=function(t,e,i,n){t.setHoverState&&t.setHoverState(!0);},a.list.onButtonOut=function(t,e,i,n){t.setHoverState&&t.setHoverState(!1);},a},tM=function(e){function i(e,n,s){var r;return h(this,i),(r=t(this,i,[e,n=QO(e,n,s)])).type="rexSimpleDropDownList",r}return d(i,e),u(i,[{key:"setOptions",value:function(t){void 0===t&&(t=[]);for(var e=0,n=t.length;e<n;e++){var s=t[e];"string"==typeof s&&(t[e]={text:s,value:s});}return m(f(i.prototype),"setOptions",this).call(this,t),this}}]),i}($O);E.register("simpleDropDownList",(function(t,e){var i=new tM(this.scene,t,e);return this.scene.add.existing(i),i})),Q(window,"RexPlugins.UI.SimpleDropDownList",tM);var eM=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},iM={clearText:function(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage:function(t){var e=this.totalLinesCount;this.sections.push(eM(t));t=this.sections.join("\n");this.lines=KP(this.parent,t,this.lines);for(var i=this.totalLinesCount-e,n=Math.ceil(i/this.pageLinesCount),s=0;s<n;s++)this.pageStartIndexes.push(e+s*this.pageLinesCount);return this},setText:function(t,e){void 0===e&&(e=!0),e&&this.resetPageIdx(),this.clearText();for(var i=eM(t).split(this.pageBreak),n=0,s=i.length;n<s;n++)this.appendPage(i[n]);return this},appendText:function(t){var e=this.content+eM(t);return this.setText(e,!1),this}},nM=Phaser.Math.Clamp,sM={getPage:function(t){return void 0===t&&(t=this.pageIndex),this.setPageIndex(t).getLines(this.startLineIndex,this.endLineIndex)},getNextPage:function(){return this.getPage(this.pageIndex+1)},getPreviousPage:function(){return this.getPage(this.pageIndex-1)},getFirstPage:function(){return this.getPage(0)},getLastPage:function(){return this.getPage(this.lastPageIndex)},resetPageIdx:function(){return this.pageIndex=-1,this},setPageIndex:function(t){return t=nM(t,0,this.lastPageIndex),this.pageIndex=t,this.startLineIndex=this.pageStartIndexes[t],this.endLineIndex=this.pageStartIndexes[t+1],this}},rM={showPage:function(t){return this.displayText(this.getPage(t)),this},showNextPage:function(){return this.displayText(this.getNextPage()),this},showPreviousPage:function(){return this.displayText(this.getPreviousPage()),this},showFirstPage:function(){return this.displayText(this.getFirstPage()),this},showLastPage:function(){return this.displayText(this.getLastPage()),this},show:function(){return this.displayText(this.getLines()),this},showNextLine:function(){return this.displayText(this.setStartLineIndex(this.startLineIndex+1).getLines()),this},showPreviousLine:function(){return this.displayText(this.setStartLineIndex(this.startLineIndex-1).getLines()),this},displayText:function(t){$P(this.parent,t);}},oM={getLines:function(t,e){var i;switch(void 0===t&&(t=this.startLineIndex),void 0===e&&(e=t+this.pageLinesCount),this.textObjectType){case 0:case 2:i=this.lines.slice(t,e).join("\n");break;case 1:var n=this.lines.getLineStartIndex(t),s=this.lines.getLineEndIndex(e-1);i=this.lines.getSliceTagText(n,s,!0);}return i}};Object.assign(oM,iM,sM,rM);var aM=Phaser.Utils.Objects.GetValue,hM=Phaser.Math.Clamp,lM=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,{eventEmitter:!1}])).textObjectType=NP(s.parent),s.pageStartIndexes=[],s.lines=KP(s.parent,""),s.sections=[],s.resetFromJSON(n),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.setMaxLines(aM(t,"maxLines",void 0)),this.setPageBreak(aM(t,"pageBreak","\f\n")),this.setText(aM(t,"text","")),this.setStartLineIndex(aM(t,"start",0)),this.setPageIndex(aM(t,"page",-1)),this}},{key:"toJSON",value:function(){return {maxLines:this.maxLines,text:this.content,start:this.startLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}},{key:"shutdown",value:function(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy();}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,m(f(i.prototype),"shutdown",this).call(this,t);}}},{key:"setMaxLines",value:function(t){return this.maxLines=t,this}},{key:"setPageBreak",value:function(t){return this.pageBreak=t,this}},{key:"pageCount",get:function(){return this.pageStartIndexes.length}},{key:"lastPageIndex",get:function(){return this.pageCount-1}},{key:"isFirstPage",get:function(){return this.pageIndex<=0}},{key:"isLastPage",get:function(){return this.pageIndex>=this.pageCount-1}},{key:"totalLinesCount",get:function(){return this.lines?this.lines.length:0}},{key:"startLineIndex",get:function(){return this._startLineIndex},set:function(t){t=hM(t,0,this.totalLinesCount-1),this._startLineIndex=t;}},{key:"setStartLineIndex",value:function(t){return this.startLineIndex=t,this}},{key:"pageLinesCount",get:function(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,n;switch(NP(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,n=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var s=t.fontSize/t.fontData.size;n=t.fontData.lineHeight*s;}return (e-i)/(n+i)}(this.parent));break;case 2:t=this.totalLinesCount;}return t}},{key:"content",get:function(){return this.sections.join(this.pageBreak)}}]),i}(mo);Object.assign(lM.prototype,oM);var uM,cM=Phaser.Utils.Objects.GetFastValue,dM=Phaser.Utils.Objects.GetValue,fM=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).timer=null,s.resetFromJSON(n),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){this.setTextWrapEnable(dM(t,"wrap",!1)),this.setTypeMode(dM(t,"typeMode",0)),this.setTypingSpeed(dM(t,"speed",333)),this.setTextCallback=cM(t,"setTextCallback",null),this.setTextCallbackScope=cM(t,"setTextCallbackScope",null),this.setTypingContent(cM(t,"text","")),this.typingIdx=cM(t,"typingIdx",0),this.insertIdx=null,this.insertChar=null;var e=cM(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIdx,e),this}},{key:"shutdown",value:function(t){this.isShutdown||(this.freeTimer(),m(f(i.prototype),"shutdown",this).call(this,t));}},{key:"setTypeMode",value:function(t){return "string"==typeof t&&(t=vM[t]),this.typeMode=t,this}},{key:"setTypeSpeed",value:function(t){return this.speed=t,this}},{key:"setTypingSpeed",value:function(t){return this.speed=t,this}},{key:"setTextWrapEnable",value:function(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}},{key:"text",get:function(){return this._text},set:function(t){var e=pM(t);this.textWrapEnable&&(e=function(t,e){switch(NP(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText;}return e}(this.parent,e)),this._text=e;}},{key:"isTyping",get:function(){return null!==this.getTimer()}},{key:"isLastChar",get:function(){return this.typingIdx===this.textLen}},{key:"start",value:function(t,e,i,n){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIdx=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(n)),this}},{key:"appendText",value:function(t){var e=this.text.concat(pM(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLen),this}},{key:"stop",value:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)this.getTypingString(this.text,this.typingIdx,this.textLen,this.typeMode),this.emit("typechar",this.insertChar),this.typingIdx++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent);}return this}},{key:"pause",value:function(){var t=this.getTimer();return t&&(t.paused=!0),this}},{key:"resume",value:function(){var t=this.getTimer();return t&&(t.paused=!1),this}},{key:"setTypingContent",value:function(t){return this.text=t,this.textLen=this.getTextLength(this.text),this}},{key:"onTyping",value:function(){var t=this.getTypingString(this.text,this.typingIdx,this.textLen,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.emit("complete",this,this.parent)):(this.timer.delay=this.speed,this.typingIdx++);}},{key:"getTypingString",value:function(t,e,i,n){var s;if(0===n){var r=0,o=e;this.insertIdx=o,s=this.getSubString(t,r,o);}else if(1===n){r=(o=i)-e;this.insertIdx=0,s=this.getSubString(t,r,o);}else if(2===n){var a=i/2;o=(r=Math.floor(a-e/2))+e;this.insertIdx=e%2?e:0,s=this.getSubString(t,r,o);}else if(3===n){var h,l=Math.floor(e/2);if(l>0){r=(o=i)-l;h=this.getSubString(t,r,o);}else h="";var u,c=e-l;if(c>0){o=(r=0)+c;this.insertIdx=o,u=this.getSubString(t,r,o);}else u="",this.insertIdx=0;s=u+h;}return this.insertChar=s.charAt(this.insertIdx-1),s}},{key:"startTimer",value:function(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}},{key:"getTimer",value:function(){return this.timer}},{key:"freeTimer",value:function(){return this.timer&&(this.timer.remove(),this.timer=null),this}},{key:"setText",value:function(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIdx):this.setTextCallback(t,this.isLastChar,this.insertIdx)),this.textWrapEnable?$P(this.parent,t):this.parent.setText(t);}},{key:"getTextLength",value:function(t){var e=this.parent;return e.getPlainText?e.getPlainText(t).length:t.length}},{key:"getSubString",value:function(t,e,i){var n=this.parent;return n.getSubString?n.getSubString(t,e,i):t.slice(e,i)}}]),i}(mo),pM=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},vM={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3},gM=Phaser.Utils.Objects.GetValue,yM=function(e){function i(e,n){return h(this,i),void 0===n&&(n={}),n.hasOwnProperty("layoutMode")||(n.layoutMode=1),t(this,i,[e,n])}return d(i,e),u(i)}((void 0===uM&&(uM="rexTextBox"),function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).type=uM;var r=s.childrenMap.text;return s.page=new lM(r,gM(n,"page",void 0)),s.typing=new fM(r,gM(n,"typing",n.type)),s.typing.on("complete",s.onPageEnd,v(s)).on("type",s.onType,v(s)).on("typechar",s.onTypeChar,v(s)),s.textWidth=r.width,s.textHeight=r.height,s}return d(i,e),u(i,[{key:"start",value:function(t,e){return this.page.setText(t),void 0!==e&&this.setTypingSpeed(e),this.emit("start"),this.typeNextPage(),this}},{key:"typeNextPage",value:function(){if(this.isLastPage)this.emit("complete");else {var t=this.page.getNextPage();this.typing.start(t);}return this}},{key:"pause",value:function(){return this.isTyping&&(this.typing.pause(),this.emit("pause")),this}},{key:"resume",value:function(){return this.isTyping||(this.emit("resume"),this.typing.resume()),this}},{key:"stop",value:function(t){return this.typing.stop(t),this}},{key:"showLastPage",value:function(){return this.typing.stop(),this.page.showLastPage(),this.emit("type"),this.onPageEnd(),this}},{key:"setTypeSpeed",value:function(t){return this.typing.setTypingSpeed(t),this}},{key:"setTypingSpeed",value:function(t){return this.typing.setTypingSpeed(t),this}},{key:"isTyping",get:function(){return this.typing.isTyping}},{key:"isLastPage",get:function(){return this.page.isLastPage}},{key:"isFirstPage",get:function(){return this.page.isFirstPage}},{key:"pageCount",get:function(){return this.page.pageCount}},{key:"pageIndex",get:function(){return this.page.pageIndex}},{key:"typingSpeed",get:function(){return this.typing.speed}},{key:"onType",value:function(){var t=this.childrenMap.text;this.textWidth===t.width&&this.textHeight===t.height||(this.textWidth=t.width,this.textHeight=t.height,this.getTopmostSizer().layout()),this.emit("type");}},{key:"onTypeChar",value:function(t){this.emit("typechar",t);}},{key:"onPageEnd",value:function(){var t=this.isLastPage;this.emit("pageend"),t&&this.emit("complete");}}]),i}(vw)));E.register("textBox",(function(t){var e=new yM(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.TextBox",yM);var mM=Phaser.Utils.Objects.GetValue,kM=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).type="rexNumberBar";var r,o=mM(n,"background",void 0),a=mM(n,"icon",void 0),l=mM(n,"iconMask",void 0),u=mM(n,"slider",void 0),c=mM(n,"text",void 0),d=mM(n,"space.icon",0),f=mM(n,"space.slider",0);(o&&s.addBackground(o),a)&&(0===s.orientation?(u||c)&&(p={right:d}):(u||c)&&(p={bottom:d}),s.add(a,{proportion:0,align:"center",padding:p}),l&&(l=Bx.call(v(s),a,a,1)));if(u){var p,g;if(u.orientation=s.orientation,u.eventEmitter=v(s),u.value=null,u.hasOwnProperty("input")||(u.input=-1),r=new gP(e,u),e.add.existing(r),0===s.orientation?c&&(p={right:f}):c&&(p={bottom:f}),0===s.orientation)g=void 0===mM(u,"width",void 0)?1:0;else g=void 0===mM(u,"height",void 0)?1:0;s.add(r,{proportion:g,align:"center",padding:p});}c&&s.add(c),s.addChildrenMap("background",o),s.addChildrenMap("icon",a),s.addChildrenMap("iconMask",l),s.addChildrenMap("slider",r),s.addChildrenMap("text",c);var y=mM(n,"valuechangeCallback",null);if(null!==y){var m=mM(n,"valuechangeCallbackScope",void 0);s.on("valuechange",y,m);}return s.setEnable(mM(n,"enable",void 0)),s.setValue(mM(n,"value",0)),s}return d(i,e),u(i,[{key:"enable",get:function(){return !!this.childrenMap.slider&&this.childrenMap.slider.enable},set:function(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"value",get:function(){return this.childrenMap.slider?this.childrenMap.slider.value:0},set:function(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t);}},{key:"setValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}},{key:"addValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}},{key:"getValue",value:function(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}},{key:"easeValueTo",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}},{key:"stopEaseValue",value:function(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}},{key:"setEaseValueDuration",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}},{key:"setEaseValueFunction",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}},{key:"text",get:function(){var t=this.childrenMap.text;return void 0===t?"":t.text?t.text:t.getData("text")},set:function(t){var e=this.childrenMap.text;void 0!==e&&(e.setText?e.setText(t):e.setData("text",t));}},{key:"setText",value:function(t){return this.text=t,this}}]),i}(Ex);E.register("numberBar",(function(t){var e=new kM(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.NumberBar",kM),E.register("scrollBar",(function(t){var e=new bP(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.ScrollBar",bP);var bM=Phaser.Utils.Objects.GetValue,xM={leftTop:"left-top",centerTop:"center-top",rightTop:"right-top",leftCenter:"left-center",center:"center",rightCenter:"right-center",leftBottom:"left-bottom",centerBottom:"center-bottom",rightBottom:"right-bottom"},CM=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).type="rexBadge";var r=bM(n,"background",void 0);r&&s.addBackground(r),s.addChildrenMap("background",r);var o=bM(n,"main",void 0);for(var a in o&&s.add(o,{key:"main",align:"center",expand:!1}),s.addChildrenMap("main",o),xM){var l=bM(n,a,void 0);l&&(s.add(l,{key:a,align:xM[a],expand:!1}),s.addChildrenMap(a,l));}return s}return d(i,e),u(i)}(rk);E.register("badgeLabel",(function(t){var e=new CM(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.BadgeLabel",CM);var wM=rk.prototype.add,SM=function(t,e,i,n,s,r,o,a,h){return t.setVisible(!1),wM.call(this,t,e,i,n,s,r,o,a,h),this},PM={add:SM,addPage:SM},TM=ip.prototype.setChildVisible,OM={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(TM.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var n=this.currentPage;return n&&(TM.call(this,n,!0),this.emit("pagevisible",n,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&n.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(OM,PM);var MM=Phaser.Utils.Objects.GetValue,EM=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).type="rexPages",s.childrenMap=s.sizerChildren,s._previousKey=void 0,s._currentKey=void 0,s.setSwapMode(MM(n,"swapMode",0)),s.setFadeInDuration(MM(n,"fadeIn",0)),s}return d(i,e),u(i,[{key:"setSwapMode",value:function(t){return "string"==typeof t&&(t=_M[t]),this.swapMode=t,this}},{key:"setFadeInDuration",value:function(t){return this.fadeInDuration=t,this}},{key:"previousKey",get:function(){return this._previousKey}},{key:"currentKey",get:function(){return this._currentKey},set:function(t){this.swapPage(t);}},{key:"currentPage",get:function(){return this.getPage(this.currentKey)}},{key:"previousPage",get:function(){return this.getPage(this.previousKey)}},{key:"keys",get:function(){return Object.keys(this.sizerChildren)}}]),i}(rk);Object.assign(EM.prototype,OM);var _M={invisible:0,destroy:1};E.register("pages",(function(t){var e=new EM(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Pages",EM);var RM=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"tint",get:function(){return 0===this.vertices.length?16777215:this.vertices[0].color}},{key:"forceUpdate",value:function(){return this.dirtyCache[10]=1,this}}]),i}(Phaser.GameObjects.Mesh),LM=Phaser.Math.Vector3,BM=Phaser.Math.Matrix4,DM=new LM,IM=new LM,jM=new BM,zM=Phaser.Utils.Objects.IsPlainObject,AM=Phaser.Utils.Objects.GetValue,FM=Phaser.Geom.Mesh.GenerateGridVerts,WM=Phaser.Math.RadToDeg,VM=Phaser.Math.DegToRad,YM=1+1/Math.sin(VM(45)),GM=function(e){function i(e,n,s,r,o,a){var l;h(this,i),zM(n)&&(n=AM(a=n,"x",0),s=AM(a,"y",0),r=AM(a,"key",null),o=AM(a,"frame",null)),(l=t(this,i,[e,n,s,r,o])).type="rexPerspectiveImage",l.setSizeToFrame(),l.resetPerspective(),l.panZ(YM),l.hideCCW=AM(a,"hideCCW",!0);var u=AM(a,"gridWidth",0),c=AM(a,"gridHeight",u);return l.resetVerts(u,c),l.prevFrame=l.frame,l}return d(i,e),u(i,[{key:"preUpdate",value:function(t,e){this.prevFrame!==this.frame&&(this.prevFrame=this.frame,this.syncSize()),m(f(i.prototype),"preUpdate",this).call(this,t,e);}},{key:"originX",get:function(){return .5}},{key:"originY",get:function(){return .5}},{key:"resetPerspective",value:function(){return this.setPerspective(this.width,this.height,45),this}},{key:"resetVerts",value:function(t,e){if(void 0!==t&&(this.gridWidth=t),void 0!==e&&(this.gridHeight=e),this.clear(),this.dirtyCache[9]=-1,0===this.width||0===this.height)return this;var i=this.frame.cutWidth,n=this.frame.cutHeight;0===this.gridWidth?t=Math.max(i/8,32):e=this.gridWidth,e=0===this.gridHeight?Math.max(n/8,32):this.gridHeight,FM({mesh:this,width:i/this.height,height:n/this.height,widthSegments:Math.ceil(i/t),heightSegments:Math.ceil(n/e)});var s=this.transformInfo;return s&&this.transformVerts(s.x,s.y,s.z,s.rotateX,s.rotateY,s.rotateZ),this}},{key:"syncSize",value:function(){return this.setSizeToFrame(),this.resetPerspective(),this.resetVerts(),this}},{key:"rotationX",get:function(){return this.modelRotation.x},set:function(t){this.modelRotation.x=t;}},{key:"angleX",get:function(){return WM(this.rotationX)},set:function(t){this.rotationX=VM(t);}},{key:"rotationY",get:function(){return this.modelRotation.y},set:function(t){this.modelRotation.y=t;}},{key:"angleY",get:function(){return WM(this.rotationY)},set:function(t){this.rotationY=VM(t);}},{key:"rotationZ",get:function(){return this.modelRotation.z},set:function(t){this.modelRotation.z=t;}},{key:"angleZ",get:function(){return WM(this.rotationZ)},set:function(t){this.rotationZ=VM(t);}},{key:"transformVerts",value:function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),this.transformInfo||(this.transformInfo={}),this.transformInfo.x=t,this.transformInfo.y=e,this.transformInfo.rotateX=n,this.transformInfo.rotateY=s,this.transformInfo.rotateZ=r,function(t,e,i,n,s,r,o){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=0),DM.set(e,i,n),IM.set(s,r,o),jM.fromRotationXYTranslation(IM,DM,!0);for(var a=0,h=t.vertices.length;a<h;a++)t.vertices[a].transformMat4(jM);}(this,t,e,i,n,s,r),this}}]),i}(RM),XM=Phaser.Textures.DynamicTexture,HM=function(t,e,i){return void 0===e&&(e=2),void 0===i&&(i=2),new XM(t.sys.textures,null,e,i)},UM=Phaser.Utils.Objects.IsPlainObject,NM=Phaser.Utils.Objects.GetValue,KM=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),UM(n)&&(n=NM(a=n,"x",0),s=NM(a,"y",0),r=NM(a,"width",32),o=NM(a,"height",32)),(l=t(this,i,[e,n,s,HM(e,r,o),null,a])).type="rexPerspectiveRenderTexture",l.rt=l.texture,l}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(m(f(i.prototype),"destroy",this).call(this,t),this.rt.destroy(),this.rt=null);}},{key:"snapshot",value:function(t,e){return void 0===e&&(e={}),e.gameObjects=t,e.renderTexture=this.rt,Zf(e),this.width===this.frame.realWidth&&this.height===this.frame.realHeight||this.syncSize(),this}}]),i}(GM);Phaser.Animations.AnimationState,Phaser.Utils.Objects.IsPlainObject,Phaser.Utils.Objects.GetValue;var JM=function(t,e,i,n){if(Array.isArray(t))for(var s=0,r=t.length;s<r;s++){var o=t[s];if((!n||o)&&(i?e.call(i,o,s,t):e(o,s,t)))return}else {for(var a in t){o=t[a];if((!n||o)&&(i?e.call(i,o,a,t):e(o,a,t)))return}}},qM=Phaser.Math.RadToDeg,ZM=Phaser.Math.DegToRad,$M=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),(l=t(this,i,[e,n,s,r,o])).faces=a,JM(a,(function(t){t.setPosition(n,s),this.add(t);}),v(l),!0),l}return d(i,e),u(i,[{key:"rotationX",get:function(){return 0},set:function(t){}},{key:"angleX",get:function(){return qM(this.rotationX)},set:function(t){this.rotationX=ZM(t);}},{key:"rotateX",get:function(){return qM(this.rotationX)},set:function(t){this.rotationX=ZM(t);}},{key:"rotationY",get:function(){return 0},set:function(t){}},{key:"angleY",get:function(){return qM(this.rotationY)},set:function(t){this.rotationY=ZM(t);}},{key:"rotateY",get:function(){return qM(this.rotationY)},set:function(t){this.rotationY=ZM(t);}},{key:"rotationZ",get:function(){return 0},set:function(t){}},{key:"angleZ",get:function(){return qM(this.rotationZ)},set:function(t){this.rotationZ=ZM(t);}},{key:"rotateZ",get:function(){return qM(this.rotationZ)},set:function(t){this.rotationZ=ZM(t);}},{key:"setDebug",value:function(t,e){return JM(this.faces,(function(i){i.setDebug(t,e);}),null,!0),this}},{key:"panX",value:function(t){return JM(this.faces,(function(e){e.panX(t);}),null,!0),this}},{key:"panY",value:function(t){return JM(this.faces,(function(e){e.panY(t);}),null,!0),this}},{key:"panZ",value:function(t){return JM(this.faces,(function(e){e.panZ(t);}),null,!0),this}},{key:"transformVerts",value:function(t,e,i,n,s,r){return JM(this.faces,(function(o){o.transformVerts(t,e,i,n,s,r);}),null,!0),this}},{key:"forEachFace",value:function(t,e,i){return JM(this.faces,t,e,i),this}}]),i}(ip),QM=Phaser.Utils.Objects.IsPlainObject,tE={key:"__WHITE"},eE={image:GM,rendertexture:KM},iE=function(t,e){var i;return void 0===e&&(e=tE),QM(e)?(e.hasOwnProperty("type")||(e.hasOwnProperty("key")?e.type="image":e.hasOwnProperty("width")&&(e.type="rendertexture")),i=new eE[e.type](t,e),t.add.existing(i)):i=e,i},nE=(0, Phaser.Math.DegToRad)(180),sE=Phaser.Utils.Objects.GetValue,rE=Phaser.Math.Linear,oE=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return m(f(i.prototype),"resetFromJSON",this).call(this,t),this.setEase(sE(t,"ease","Cubic")),this.setFrontToBackDirection(sE(t,"frontToBack",0)),this.setBackToFrontDirection(sE(t,"backToFront",1)),this}},{key:"setFrontToBackDirection",value:function(t){return "string"==typeof t&&(t=aE[t]),this.endAngleFB=0===t?180:-180,this}},{key:"setBackToFrontDirection",value:function(t){return "string"==typeof t&&(t=aE[t]),this.endAngleBF=0===t?-180:180,this}},{key:"start",value:function(t,e){if(this.timer.isRunning)return this;this.timer.setDelay(this.delay).setDuration(t);var n=e+1;return 0===this.parent.face?(this.startAngle=0,this.endAngle=this.endAngleFB*n):(this.startAngle=this.endAngleBF,this.endAngle=this.startAngle-this.endAngleBF*n),m(f(i.prototype),"start",this).call(this),this}},{key:"flip",value:function(t,e){return this.isRunning||(void 0===t&&(t=this.duration),void 0===e&&(e=0),this.start(t,e),this.emit("start",this.parent,this),this.parent.currentFaceIndex=(this.parent.currentFaceIndex+e+1)%2),this}},{key:"flipRight",value:function(t,e){return 0===this.parent.currentFaceIndex?this.setFrontToBackDirection(0):this.setBackToFrontDirection(0),this.flip(t,e),this}},{key:"flipLeft",value:function(t,e){return 0===this.parent.currentFaceIndex?this.setFrontToBackDirection(1):this.setBackToFrontDirection(1),this.flip(t,e),this}},{key:"updateGameObject",value:function(t,e){var i=this.easeFn(e.t),n=rE(this.startAngle,this.endAngle,i);0===t.orientation?t.angleY=n:t.angleX=n;}}]),i}(zo),aE={right:0,"left-to-right":0,left:1,"right-to-left":1},hE=Phaser.Utils.Objects.IsPlainObject,lE=Phaser.Utils.Objects.GetValue,uE=["back","front"],cE=function(e){function i(e,n,s,r){var o;h(this,i),hE(n)&&(n=lE(r=n,"x",0),s=lE(r,"y",0));var a=function(t,e,i){var n;if(void 0===i){var s;n=[];for(var r=0,o=e.length;r<o;r++)a=(s=e[r])?iE(t,s):null,n.push(a);}else {var a,h;for(n={},r=0,o=i.length;r<o;r++)h=i[r],a=e.hasOwnProperty(h)?iE(t,e[h]):null,n[h]=a;}return n}(e,r,uE),l=a.back,u=a.front,c=lE(r,"width"),d=lE(r,"height");if(void 0===c||void 0===d){if(void 0===c){var f=u?u.width:0,p=l?l.width:0;c=Math.max(f,p);}if(void 0===d){var g=u?u.height:0,y=l?l.height:0;d=Math.max(g,y);}}(o=t(this,i,[e,n,s,c,d,a])).type="rexPerspectiveCard",o.frontFaceRotationX=0,o.frontFaceRotationY=0,o.frontFaceRotationZ=0,JM(a,(function(t,e){this["".concat(e,"Face")]=t;}),v(o));var m=lE(r,"flip",void 0);return !1!==m&&(o.flip=new oE(v(o),m)),o.setOrientation(lE(r,"orientation",0)),function(t,e){var i=e.back;i&&(0===t.orientation?i.transformVerts(0,0,0,0,nE,0):i.transformVerts(0,0,0,nE,0,0));}(v(o),a),o.setFace(lE(r,"face",0)),o}return d(i,e),u(i,[{key:"rotationX",get:function(){return this.frontFaceRotationX},set:function(t){this.frontFaceRotationX!==t&&(this.frontFaceRotationX=t,JM(this.faces,(function(e){e.rotationX=t;}),null,!0));}},{key:"rotationY",get:function(){return this.frontFaceRotationY},set:function(t){this.frontFaceRotationY!==t&&(this.frontFaceRotationY=t,JM(this.faces,(function(e){e.rotationY=t;}),null,!0));}},{key:"rotationZ",get:function(){return this.frontFaceRotationZ},set:function(t){this.frontFaceRotationZ!==t&&(this.frontFaceRotationZ=t,JM(this.faces,(function(e){e.rotationZ=t;}),null,!0));}},{key:"setOrientation",value:function(t){return "string"==typeof t&&(t=dE[t]),this.orientation=t,this}},{key:"face",get:function(){return this.currentFaceIndex},set:function(t){"string"==typeof t&&(t=fE[t]),this.currentFaceIndex=t;var e=1===t?180:0;0===this.orientation?this.angleY=e:this.angleX=e;}},{key:"setFace",value:function(t){return this.face=t,this}},{key:"toggleFace",value:function(){var t=0===this.face?1:0;return this.setFace(t),this}}]),i}($M),dE={x:0,horizontal:0,h:0,y:1,vertical:1,v:1},fE={front:0,back:1};Phaser.Utils.Objects.GetValue,Phaser.Math.RadToDeg,Phaser.Math.DegToRad,Phaser.Math.Angle.WrapDegrees,Phaser.Math.Angle.ShortestBetween,Phaser.Math.Wrap,Phaser.Math.Linear,Phaser.Utils.Objects.IsPlainObject,Phaser.Utils.Objects.GetValue,Phaser.Math.DegToRad,Phaser.Math.RadToDeg,Phaser.Math.Angle.WrapDegrees,Phaser.Math.Linear,Phaser.Math.Wrap,Phaser.Utils.Objects.IsPlainObject,Phaser.Utils.Objects.GetValue,Phaser.Math.Wrap;var pE=Phaser.Utils.Objects.GetValue,vE=function(t,e){if(!t)return !1;for(var i=e.visibleSibling,n=0,s=i.length;n<s;n++)t.setChildVisible(i[n],!0);return i.length=0,t.setChildVisible(e,!1),e.isRunning=!1,!0},gE=function(e){return function(e){function i(e,n){var s;h(this,i);var r=e.scene;return s=t(this,i,[r,0,0,1,1,n]),r.add.existing(v(s)),function(t,e,i){e.visibleSibling=[],e.isRunning=!1,e.useParentBounds=pE(i,"useParentBounds",!1),e.setPosition(t.x,t.y).setVisible(!1),t.pin(e);}(e,v(s),n),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.exit(),m(f(i.prototype),"destroy",this).call(this,t));}},{key:"enter",value:function(){var t=function(t,e){if(!t)return !1;vE(t,e);var i=e.useParentBounds;Zf({gameObjects:t.getAllVisibleChildren(),renderTexture:e.rt,x:e.x,y:e.y,width:i?t.displayWidth:void 0,height:i?t.displayHeighth:void 0,originX:i?t.originX:void 0,originY:i?t.originY:void 0}),t.setChildVisible(e,!0);for(var n=e.visibleSibling,s=t.children,r=0,o=s.length;r<o;r++){var a=s[r];a.visible&&a!==e&&(t.setChildVisible(a,!1),n.push(a));}return e.isRunning=!0,!0}(this.rexContainer.parent,this);return t&&this.syncSize(),this}},{key:"exit",value:function(){return vE(this.rexContainer.parent,this),this}}]),i}(e)},yE=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"perspectiveState",get:function(){return this.isRunning}}]),i}(gE(KM)),mE=Phaser.Utils.Objects.GetValue,kE=function(t){var e=this.scene;this.setSnapshotPadding(mE(t,"snapshotPadding",0)),delete(t=ni(t)).width,delete t.height,t.front={width:1,height:1},t.back={width:1,height:1};var i=new cE(e,t);e.add.existing(i);var n=i.flip;if(n){var s=this;n.on("start",(function(){s.enterPerspectiveMode();})).on("complete",(function(){s.exitPerspectiveMode();}));}return i},bE=["front","back"],xE={enterPerspectiveMode:function(){return this.isInPerspectiveMode||(this.setChildVisible(this.perspectiveCard,!0),this.snapshotFace(0),this.snapshotFace(1),this.setChildVisible(this.childrenMap.front,!1),this.setChildVisible(this.childrenMap.back,!1),this.perspectiveCard.setSize(this.width,this.height)),this},exitPerspectiveMode:function(){if(!this.isInPerspectiveMode)return this;this.setChildVisible(this.perspectiveCard,!1);var t=0===this.perspectiveCard.face;return this.setChildVisible(this.childrenMap.front,t),this.setChildVisible(this.childrenMap.back,!t),this},setSnapshotPadding:function(t){return this.snapshotPadding=t,this},snapshotFace:function(t){"number"==typeof t&&(t=bE[t]);var e=this.perspectiveCard.faces[t],i=this.childrenMap[t];e.rt.clear();var n=i.visible;i.visible=!0;var s=i.isRexContainerLite?i.getAllVisibleChildren():i;return e.snapshot(s,{padding:this.snapshotPadding}),i.visible=n,this}},CE=Phaser.Utils.Objects.GetValue,wE=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).type="rexPerspectiveCard";var r=n.back,o=CE(n,"expand.back",!0);s.add(r,{key:"back",expand:o});var a=n.front,l=CE(n,"expand.front",!0);return s.add(a,{key:"front",expand:l}),s.perspectiveCard=kE.call(v(s),n),s.pin(s.perspectiveCard),s.exitPerspectiveMode(!1),s}return d(i,e),u(i,[{key:"flip",get:function(){return this.perspectiveCard.flip}},{key:"face",get:function(){return this.perspectiveCard.face},set:function(t){if(!this.flip||!this.flip.isRunning){this.perspectiveCard.face=t;var e=0===t,i=this.childrenMap.front,n=this.childrenMap.back;this.setChildVisible(i,e),this.setChildVisible(n,!e);}}},{key:"setFace",value:function(t){return this.face=t,this}},{key:"toggleFace",value:function(){var t=0===this.face?1:0;return this.setFace(t),this}},{key:"isInPerspectiveMode",get:function(){return this.perspectiveCard.visible}},{key:"rotationX",get:function(){return this.perspectiveCard.rotationX},set:function(t){this.enterPerspectiveMode(),this.perspectiveCard.rotationX=t;}},{key:"angleX",get:function(){return this.perspectiveCard.angleX},set:function(t){this.enterPerspectiveMode(),this.perspectiveCard.angleX=t;}},{key:"rotationY",get:function(){return this.perspectiveCard.rotationY},set:function(t){this.enterPerspectiveMode(),this.perspectiveCard.rotationY=t;}},{key:"angleY",get:function(){return this.perspectiveCard.angleY},set:function(t){this.enterPerspectiveMode(),this.perspectiveCard.angleY=t;}},{key:"rotationZ",get:function(){return this.perspectiveCard.rotationZ},set:function(t){this.enterPerspectiveMode(),this.perspectiveCard.rotationZ=t;}},{key:"angleZ",get:function(){return this.perspectiveCard.angleZ},set:function(t){this.enterPerspectiveMode(),this.perspectiveCard.angleZ=t;}},{key:"panX",value:function(t){return this.enterPerspectiveMode(),this.perspectiveCard.panX(t),this}},{key:"panY",value:function(t){return this.enterPerspectiveMode(),this.perspectiveCard.panY(t),this}},{key:"panZ",value:function(t){return this.enterPerspectiveMode(),this.perspectiveCard.panZ(t),this}},{key:"transformVerts",value:function(t,e,i,n,s,r){return this.enterPerspectiveMode(),this.perspectiveCard.transformVerts(t,e,i,n,s,r),this}},{key:"forEachFace",value:function(t,e,i){return this.enterPerspectiveMode(),this.perspectiveCard.forEachFace(t,e,i),this}}]),i}(rk);Object.assign(wE.prototype,xE),E.register("perspectiveCard",(function(t){var e=new wE(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.PerspectiveCard",wE);var SE=Phaser.Utils.Objects.IsPlainObject,PE=Phaser.Utils.Objects.GetValue,TE=Phaser.Utils.String.UUID,OE={swapPage:function(t,e){var i,n;null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(n=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==n&&(this.childrenMap.pages.fadeInDuration=n));return this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},ME={top:1,left:3,right:5,bottom:7},EE={top:"bottom",left:"right",right:"left",bottom:"top"},_E={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,n=e.length;i<n;i++)if(e[i].name===t)return i},addPage:function(t,e,i){if(SE(t)){var n=t;t=PE(n,"key"),e=PE(n,"tab"),i=PE(n,"page");}return t||(t=TE()),e.name=t,this.childrenMap.tabs.addButton(e),this.childrenMap.pages.addPage(i,{key:t}),this},getPage:function(t){return "number"==typeof t&&(t=this.getPageKey(t)),this.childrenMap.pages.getPage(t)},getTab:function(t){var e;return e="number"==typeof t?t:this.getPageIndex(t),this.getElement("tabs.buttons")[e]},setTabPosition:function(t){var e=ME[t];if(void 0===e)return this;var i=this.childrenMap.tabs,n=this.sizerChildren.indexOf(i);if(n===e)return this;this.sizerChildren[n]=null,this.sizerChildren[e]=i;var s=this.getSizerConfig(i).padding,r=EE[this.tabsPosition];return s[EE[t]]=s[r],s[r]=0,this.tabsPosition=t,this}};Object.assign(_E,OE,{removePage:function(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,n=i.getByName(t),s=this.childrenMap.pages,r=s.getElement(t);return n&&r?(s.removeChildrenMap(t),i.removeButton(n,e),s.remove(r,e),this):this},removeAllPages:function(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}});var RE=Phaser.Utils.Objects.GetValue,LE=LC.prototype.add,BE=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),n.column=3,n.row=3,n.columnProportions=[0,0,0],n.rowProportions=[0,0,0];var r=RE(n,"expand.pages",!0);r&&(n.columnProportions[1]=1,n.rowProportions[1]=1),(s=t(this,i,[e,n])).type="rexTabPages";var o=RE(n,"background",void 0);o&&s.addBackground(o);var a=RE(n,"pages"),l=new EM(e,a);e.add.existing(l);var u=RE(n,"tabsPosition",void 0);void 0===u&&(u=RE(n,"tabPosition","top"));var c=RE(n,"wrapTabs",!1),d=c?kS:iS,f=RE(n,"tabs",void 0);void 0===f&&(f={}),f.orientation="top"===u||"bottom"===u?"x":"y",f.buttonsType="radio",c||f.hasOwnProperty("expand")||(f.expand=RE(n,"expand.tabs",!1));var p,g,y=new d(e,f);e.add.existing(y),LE.call(v(s),l,{column:1,row:1,expand:r});var m=RE(n,"space.item",0);switch(u){case"top":p=1,g=0,m={bottom:m};break;case"bottom":p=1,g=2,m={top:m};break;case"left":p=0,g=1,m={right:m};break;case"right":p=2,g=1,m={left:m};}return LE.call(v(s),y,{column:p,row:g,padding:m,expand:!!c||RE(n,"expand.tabs",!1),align:RE(n,"align.tabs","left")}),s.addChildrenMap("background",o),s.addChildrenMap("tabs",y),s.addChildrenMap("pages",l),s.tabsPosition=u,y.on("button.click",(function(t){var e=t.name;l.hasPage(e)&&l.swapPage(e);})),y.on("button.statechange",(function(t,e,i,n){var s=i?"tab.focus":"tab.blur";this.emit(s,t,t.name);}),v(s)),l.on("pagevisible",(function(t,e,i){this.emit("page.focus",t,e);})),l.on("pageinvisible",(function(t,e,i){this.emit("page.blur",t,e);})),s}return d(i,e),u(i,[{key:"currentKey",get:function(){return this.getElement("pages").currentKey},set:function(t){this.showPage(t);}},{key:"keys",get:function(){return this.getElement("pages").keys}},{key:"currentPage",get:function(){return this.getElement("pages").currentPage}},{key:"previousPage",get:function(){return this.getElement("pages").previousPage}}]),i}(LC);Object.assign(BE.prototype,_E),E.register("tabPages",(function(t){var e=new BE(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.TabPages",BE);var DE=function(e){function i(e,n){return h(this,i),void 0===n&&(n={}),n.destroy=!1,t(this,i,[e,n])}return d(i,e),u(i,[{key:"onOpen",value:function(){this.emit("open",this.parent,this),m(f(i.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.parent,this),m(f(i.prototype),"onClose",this).call(this);}}]),i}(Sg),IE={expand:function(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;(this.show(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();return e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this);}),this).requestOpen(null,t),this},collapse:function(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){(this.setChildScale(i,1,1).hide(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();this.emit("collapse.complete",this);}),this).requestClose(null,t),this},toggle:function(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState:function(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},jE=function(t,e){wv.popUp.call(t,e,this.expandDirection);},zE=function(t,e){wv.scaleDown.call(t,e,this.expandDirection);},AE={setTransitionDuration:function(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback:function(t){return void 0===t&&(t=jE.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback:function(t){return void 0===t&&(t=zE.bind(this)),this.childTransition.setTransitOutCallback(t),this}},FE=Phaser.Utils.Objects.GetValue,WE=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),n.hasOwnProperty("orientation")||(n.orientation=1),(s=t(this,i,[e,n])).type="rexFolder",s.reLayoutEnable=!0,s.expanded=void 0,s.expandDirection=1===s.orientation?"y":"x";var r=n.background,o=n.title,a=n.child;r&&s.addBackground(r);var l=FE(n,"space"),u=1===s.orientation?"left":"top",c=FE(n,"align.title",u),d=FE(n,"expand.title",!0);s.add(o,{proportion:0,align:c,expand:d,padding:{left:FE(l,"titleLeft",0),right:FE(l,"titleRight",0),top:FE(l,"titleTop",0),bottom:FE(l,"titleBottom",0)}});var f=FE(n,"toggleByTarget",void 0),p=FE(n,"toggleClickConfig");if(void 0===f&&(f=o),f&&iy.onClick.call(f,(function(){this.toggle();}),v(s),p),s.childTransition=new DE(a),!FE(n,"customChildOrigin",!1)){var g=s.rtl?1:0;a.setOrigin(g);}c=FE(n,"align.child","left");var y=(d=FE(n,"expand.child",!0))?1:0;s.add(a,{proportion:y,align:c,expand:d,padding:{left:FE(l,"childLeft",0),right:FE(l,"childRight",0),top:FE(l,"childTop",0),bottom:FE(l,"childBottom",0)}}),s.addChildrenMap("title",o),s.addChildrenMap("child",a),s.addChildrenMap("background",r);var m=n.transition;s.setTransitionDuration(FE(m,"duration",200)),s.setExpandCallback(FE(m,"expandCallback",void 0)),s.setCollapseCallback(FE(m,"collapseCallback",void 0)),s.reLayoutTarget=FE(n,"reLayoutTarget",void 0);var k=n.onExpandStart;k&&s.on("expand.start",k);var b=n.onExpandComplete;b&&s.on("expand.complete",b);var x=n.onCollapseStart;x&&s.on("collapse.start",x);var C=n.onCollapseComplete;C&&s.on("collapse.complete",C);var w=FE(n,"expanded",void 0);return void 0!==w&&s.setExpandedState(w),s}return d(i,e),u(i)}(Ex);Object.assign(WE.prototype,IE,AE),E.register("folder",(function(t){var e=new WE(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Folder",WE);var VE=function(e){return function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"setText",value:function(t){return this.text=t,this}},{key:"text",get:function(){return this.childrenMap.nodeBody.text},set:function(t){var e=this.childrenMap.nodeBody;e.setText&&e.setText(t);}},{key:"setTexture",value:function(t,e){var i=this.childrenMap.nodeBody;return i.setTexture&&i.setTexture(t,e),this}},{key:"texture",get:function(){var t=this.childrenMap.nodeBody;if(t)return t.texture}},{key:"frame",get:function(){var t=this.childrenMap.nodeBody;if(t)return t.frame}}]),i}(e)},YE={getTreePatent:function(t){if(void 0===t&&(t=this),t.rexSizer)return t.rexSizer.treeParent},getTreeRoot:function(t){var e;for(void 0===t&&(t=this);;){if(!t.rexSizer)return;if(null===(e=t.rexSizer.treeParent))return t;t=e;}},isGrandsonNode:function(t){if(void 0===t||!t.rexSizer)return !1;for(var e;;){if(!t.rexSizer)return !1;if((e=t.rexSizer.treeParent)===this)return !0;if(null===e)return !1;t=e;}return !1}},GE=Phaser.Utils.Objects.GetValue,XE=function(t,e,i,n,s){var r,o=GE(e,i);return Nf(o)?(r=o,delete e[i]):Gg(o)?(r=o(t,n),t.add.existing(r)):s&&(r=s(t,o,n),t.add.existing(r)),r},HE=Phaser.Utils.Objects.GetValue,UE=function(e){function i(e,n,s){var r;h(this,i);var o=n.space;(r=t(this,i,[e,{orientation:"x",space:{left:HE(o,"nodeLeft",0),right:HE(o,"nodeRight",0),top:HE(o,"nodeTop",0),bottom:HE(o,"nodeBottom",0)}}])).type="rexTreeNode";var a=XE(e,n,"nodeBackground",s),l=XE(e,n,"nodeBody",s,NE);return a&&r.addBackground(a),r.add(l,{proportion:1,key:"nodeBody"}),r}return d(i,e),u(i,[{key:"getTreePatent",value:function(){return this.rexSizer.treeParent}},{key:"getTreeRoot",value:function(){var t=this.rexSizer.treeParent;return t?t.getTreeRoot():null}}]),i}(VE(Ex)),NE=function(t,e,i){var n=new lw(t,e);return n.resetDisplayContent(""),n},KE=function(t,e){var i=t.parentContainer;if(i)e.isRexContainerLite?e.addToContainer(i):i.add(e);else {var n=t.displayList;Af(n)?e.isRexContainerLite?e.addToLayer(n):n.add(e):t.scene.add.existing(e);}},JE=Phaser.Utils.String.UUID,qE={addTree:function(t,e){Nf(t)&&(t={nodeBody:t,nodeKey:e});return this.insertTree(void 0,t)},insertTree:function(t,e){var i;"string"==typeof e?(i=e,e=void 0):e&&(i=e.nodeKey,delete e.nodeKey),void 0===i&&(i=JE());var n=this.createTree(e);return KE(this,n),this.insertNode(t,n,{expand:!0}),n},addNode:function(t,e){return this.insertNode(void 0,t,e)},insertNode:function(t,e,i){var n;return Nf(e)||(i=e,e=new UE(this.scene,this.configSave,{isLeaf:!0})),"string"==typeof i?(n=i,i=void 0):i&&(n=i.nodeKey,delete i.nodeKey),void 0===n&&(n=JE()),void 0===i&&(i={}),i.hasOwnProperty("expand")||(i.expand=!0),this.removeNode(e,!1),e.rexSizer.treeParent=this,this.nodesMap.hasOwnProperty(n)&&(console.error("[Trees] Duplicate nodeKey '".concat(n,"'")),this.removeNode(this.nodesMap[n],!0)),e.nodeKey=n,this.nodesMap[n]=e,this.childrenMap.child.insert(t,e,i),e}},ZE={getNode:function(t){if("string"==typeof t&&(t=t.split(".")),0!==t.length){var e=t.shift(),i=this.nodesMap[e];return 0===t.length?i:i&&this.isTree(i)?i.getNode(t):null}},getNodes:function(t){var e=this.nodesMap;if(t)for(var i in e)t.push(e[i]);else t=nodes;return t},getAllNodes:function(t){}},$E={};Object.assign($E,YE,qE,{removeNode:function(t,e){if(!t)return this;var i=this.getTreePatent(t);return i?(delete i.nodesMap[t.nodeKey],t.nodeKey=null,t.rexSizer.treeParent=null,i.childrenMap.child.remove(t,e),this):this},removeAllNodes:function(t){var e=this.nodesMap;for(var i in e)this.removeNode(e[i],t);return this}},ZE);var QE=Phaser.Utils.Objects.GetValue,t_=function(t,e,i){var n=new Gd(t,e);return n.on("expand.start",(function(t){t.setDirection("down");})).on("collapse.complete",(function(t){t.setDirection("right");})),n},e_=Phaser.Utils.Objects.GetValue,i_=Phaser.Utils.Objects.Clone,n_=Phaser.Utils.Objects.GetValue,s_=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={});var r=XE(e,n,"background",{isLeaf:!1}),o=function(t,e){var i=new Ex(t,{orientation:e_(e,"childrenOrientation","y")});t.add.existing(i);var n=XE(t,e,"childrenBackground",{isLeaf:!1});return n&&i.addBackground(n),i}(e,n),a=o.childrenMap.items,l=function(t,e){var i=new UE(t,e,{isLeaf:!1});t.add.existing(i);var n=XE(t,e,"toggleButton",{isLeaf:!1},t_);return i.insert(0,n,{padding:{right:QE(e,"space.toggleButton",0)},fitRatio:1,key:"toggleButton"}),i}(e,n),u=l.childrenMap.toggleButton,c=l.childrenMap.nodeBody,d=Tx(n_(n,"orientation","y")),f=n.space;if(f){var p=n_(f,"indent",0);f.childLeft=n_(f,"indentLeft",1===d?p:0),f.childRight=n_(f,"indentRight",0),f.childTop=n_(f,"indentTop",0===d?p:0),f.childBottom=n_(f,"indentBottom",0);}(s=t(this,i,[e,{background:r,title:l,child:o,toggleByTarget:u,transition:n.transition,orientation:d,space:f,align:n.align,expand:n.expand}])).type="rexTree",s.rexSizer.treeParent=null,s.nodesMap={},s.configSave=n,s.addChildrenMap("toggleButton",u),s.addChildrenMap("nodeBody",c),s.addChildrenMap("childrenNodes",a),s.on("expand.start",(function(){u.emit("expand.start",u);})).on("expand.complete",(function(){u.emit("expand.complete",u);})).on("collapse.start",(function(){u.emit("collapse.start",u);})).on("collapse.complete",(function(){u.emit("collapse.complete",u);}));var v=n_(n,"expanded",!0);return void 0!==v&&s.setExpandedState(v),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.configSave=void 0,Clear(this.nodesMap),this.nodesMap=void 0,m(f(i.prototype),"destroy",this).call(this,t));}},{key:"createTree",value:function(t){return i.CreateTree(this.scene,this.configSave,t)}},{key:"isTree",value:function(t){return !!t&&t instanceof TreeNode}}]),i}(VE(WE));s_.CreateTree=function(t,e,i){return new s_(t,function(t,e){var i=t?i_(t):{};if(!e)return i;for(var n in e)i[n]=e[n];return i}(e,i))},Object.assign(s_.prototype,$E);var r_=Phaser.Utils.String.UUID,o_={addTree:function(t){Nf(t)&&(t={nodeBody:t,nodeKey:nodeKey});return this.insertTree(void 0,t)},insertTree:function(t,e){var i;"string"==typeof e?(i=e,e=void 0):e&&(i=e.nodeKey,delete e.nodeKey),void 0===i&&(i=r_());var n=s_.CreateTree(this.scene,this.treeConfig,e);return KE(this,n),n.nodeKey=i,this.treesMap[i]=n,this.insert(t,n,{expand:!0}),n}},a_={getTree:function(t){return this.treesMap[t]},getNode:function(t){var e=t.indexOf(".");if(-1===e)return this.getTree(t);var i=this.getTree(t.substring(0,e));return i?i.getNode(t.substring(e+1)):void 0}},h_={};Object.assign(h_,o_,{removeTree:function(t,e){return t?(delete this.treesMap[t.nodeKey],t.nodeKey=null,this.remove(t,e),this):this},removeAllNodes:function(t){var e=this.treesMap;for(var i in e)this.removeTree(e[i],t);return this}},a_);var l_=Phaser.Utils.Objects.GetValue,u_=function(e){function i(e,n){var s;return h(this,i),void 0===n&&(n={}),n.hasOwnProperty("orientation")||(n.orientation="y"),(s=t(this,i,[e,n])).type="rexTrees",s.treesMap={},s.treeConfig=l_(n,"tree"),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.treeConfig=void 0,Clear(this.treesMap),this.treesMap=void 0,m(f(i.prototype),"destroy",this).call(this,t));}}]),i}(Ex);Object.assign(u_.prototype,h_),E.register("trees",(function(t){var e=new u_(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Trees",u_),E.register("textArea",(function(t){var e=new uT(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.TextArea",uT);var c_={scrollToLine:function(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine:function(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}},d_=Phaser.Utils.Objects.GetValue,f_=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={});var r,o=d_(n,"text");Nf(o)?r=o:(void 0===o&&(o={}),o.textArea=!0,r=new vu(e,o),e.add.existing(r)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e;}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}});}(r);var a=void 0===o.width,l=void 0===o.height;a&&(r.minWidth=0),l&&(r.minHeight=0),n.scrollMode=0,n.type="rexTextAreaInput",n.child={gameObject:r,expandWidth:a,expandHeight:l};var u,c,d=d_(n,"space",void 0);d&&(d.child=d_(d,"text",0)),n.scroller=!1,(s=t(this,i,[e,n])).addChildrenMap("text",r),r.on("cursorin",(function(){var t=r.textOY,e=r.contentHeight,i=u!==t,n=c!==e;u=t,c=e,n&&this.resizeController(),(i||n)&&(this.t=r.t);}),v(s)),r.on("textchange",(function(t){this.emit("textchange",t,this);}),v(s));var f=d_(n,"content",void 0);return f&&s.setText(f),s}return d(i,e),u(i,[{key:"text",get:function(){return this.childrenMap.child.text}},{key:"lineHeight",get:function(){return this.childrenMap.child.lineHeight}},{key:"lineIndex",get:function(){return Math.floor(-this.childOY/this.lineHeight)}},{key:"linesCount",get:function(){return this.childrenMap.child.linesCount}},{key:"contentHeight",get:function(){return this.childrenMap.child.contentHeight}},{key:"readOnly",get:function(){return this.childrenMap.child.readOnly},set:function(t){this.childrenMap.child.readOnly=t;}},{key:"setReadOnly",value:function(t){return this.childrenMap.child.setReadOnly(t),this}}]),i}(HP);Object.assign(f_.prototype,{setText:function(t){return this.childrenMap.child.setText(t),this},appendText:function(t){return this.setText(this.text+t),this}},c_),E.register("textAreaInput",(function(t){var e=new f_(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.TextAreaInput",f_);var p_={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e=this.child,i=!1;if(e.rexSizer.hidden)t=0;else if(0===this.scrollMode)void 0===(t=this.getChildWidth(e))&&(i=!0);else t=0;return i?void 0:t},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e=this.child,i=!1;if(e.rexSizer.hidden)t=0;else switch(this.scrollMode){case 0:default:t=0;break;case 1:void 0===(t=this.getChildHeight(e))&&(i=!0);}return i?void 0:t},getChildrenSizers:function(t){return void 0===t&&(t=[]),this.child&&this.child.isRexSizer&&t.push(this.child),t},resetChildPosition:function(){var t=this.left,e=this.top;switch(this.scrollMode){case 0:e+=this.childOY;break;case 1:t+=this.childOY;break;default:e+=this.childOY,t+=this.childOX;}this.child.setPosition(t,e),this.resetChildPositionState(this.child),this.setMaskChildrenFlag();},layoutChildren:function(){var t,e,i=this.child;if(!i.rexSizer.hidden){switch(this.scrollMode){case 0:t=this.width;break;case 1:e=this.height;}i.isRexSizer?i.runLayout(this,t,e):uv(i,t,e),this.resetChildPosition(),this.layoutChildrenMask(),this.maskChildren();}},removeChildCallback:function(t,e){e||t.clearMask&&t.clearMask(!1);}};Object.assign(p_,qT);var v_=Phaser.Utils.Objects.IsPlainObject,g_=Phaser.Utils.Objects.GetValue,y_=Phaser.Display.Align.TOP_LEFT,m_=function(e){function i(e,n,s,r,o,a){var l;h(this,i),v_(n)?(n=g_(a=n,"x",0),s=g_(a,"y",0),r=g_(a,"width",void 0),o=g_(a,"height",void 0)):v_(r)&&(r=g_(a=r,"width",void 0),o=g_(a,"height",void 0)),(l=t(this,i,[e,n,s,r,o,a])).type="rexScrollableBlock",l.child=void 0,l.childrenMask=void 0,l._childOY=0,l._childOX=0,l.execeedTopState=!1,l.execeedBottomState=!1,l.execeedLeftState=!1,l.execeedRightState=!1,l.setScrollMode(g_(a,"scrollMode",0));var u=g_(a,"clamplChildOY",!0),c=g_(a,"clamplChildOX",u);l.setClampMode(u,c);var d=g_(a,"child",void 0),f=g_(a,"expand",!0);d.setOrigin&&d.setOrigin(0),l.add(d),l.sizerChildren=[d];var p=l.getSizerConfig(d);return p.align=y_,p.expand=f,l.child=d,l.setupChildrenMask(g_(a,"mask",void 0)),l.childrenMask&&(l.maskGameObject=WT(l.childrenMask)),l}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.destroyChildrenMask(),this.child=void 0,m(f(i.prototype),"destroy",this).call(this,t));}},{key:"setScrollMode",value:function(t){return "string"==typeof t&&(t=YS[t.toLowerCase()]),this.scrollMode=t,this}},{key:"setClampMode",value:function(t,e){return this.clampChildOY=t,this.clampChildOX=e,this}},{key:"instHeight",get:function(){return 0===this.scrollMode||2===this.scrollMode?this.height:this.width}},{key:"instWidth",get:function(){return 0===this.scrollMode||2===this.scrollMode?this.width:this.height}},{key:"childHeight",get:function(){return 0===this.scrollMode||2===this.scrollMode?Yr(this.child):Vr(this.child)}},{key:"childWidth",get:function(){return 0===this.scrollMode||2===this.scrollMode?Vr(this.child):Yr(this.child)}},{key:"topChildOY",get:function(){return 0}},{key:"bottomChildOY",get:function(){return -this.visibleHeight}},{key:"leftChildOX",get:function(){return 0}},{key:"rightChildOX",get:function(){return -this.visibleWidth}},{key:"childVisibleHeight",get:function(){return this.instHeight}},{key:"childVisibleWidth",get:function(){return this.instWidth}},{key:"visibleHeight",get:function(){var t=this.childHeight-this.childVisibleHeight;return t<0&&(t=0),t}},{key:"visibleWidth",get:function(){var t=this.childWidth-this.childVisibleWidth;return t<0&&(t=0),t}},{key:"childOYExceedTop",value:function(t){return void 0===t&&(t=this.childOY),t>this.topChildOY}},{key:"childOYExeceedBottom",value:function(t){return void 0===t&&(t=this.childOY),t<this.bottomChildOY}},{key:"childOXExceedLeft",value:function(t){return void 0===t&&(t=this.childOX),t>this.leftChildOX}},{key:"childOXExeceedRight",value:function(t){return void 0===t&&(t=this.childOX),t<this.rightChildOX}},{key:"childOY",get:function(){return this._childOY},set:function(t){var e=this.topChildOY,i=this.bottomChildOY,n=this.childOYExceedTop(t),s=this.childOYExeceedBottom(t);this.clampChildOY&&(this.childVisibleHeight>this.childHeight?t=0:n?t=e:s&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,s&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=s;}},{key:"childOX",get:function(){return this._childOX},set:function(t){var e=this.leftChildOX,i=this.rightChildOX,n=this.childOXExceedLeft(t),s=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:n?t=e:s&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),n&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=n,s&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=s;}},{key:"setChildOY",value:function(t){return this.childOY=t,this}},{key:"setChildOX",value:function(t){return this.childOX=t,this}},{key:"t",get:function(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t},set:function(t){this.childOY=-this.visibleHeight*t;}},{key:"s",get:function(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t},set:function(t){this.childOX=-this.visibleWidth*t;}},{key:"setChildOYByPercentage",value:function(t){return this.t=t,this}},{key:"setChildOXByPercentage",value:function(t){return this.s=t,this}}]),i}(Vm);Object.assign(m_.prototype,p_);var k_=["top","bottom","centerY","center"],b_=["left","right","centerX","center"],x_=function(t,e,i){var n,s="Y"===(e=e.toUpperCase()),r=this.childrenMap.child;if(s){if(i)for(var o=0,a=k_.length;o<a;o++){var h=k_[o];if(-1!==i.indexOf(h)){i=h;break}}switch(i){case"top":n=r.top-t.getTopLeft().y;break;case"bottom":n=r.bottom-t.getBottomLeft().y;break;case"centerY":case"center":n=r.centerY-t.getCenter().y;break;default:var l=r.top-t.getTopLeft().y,u=r.bottom-t.getBottomLeft().y;n=l<=0&&u>=0?0:Math.abs(l)<=Math.abs(u)?l:u;}}else {if(i)for(o=0,a=b_.length;o<a;o++){h=b_[o];if(-1!==i.indexOf(h)){i=h;break}}switch(i){case"left":n=r.left-t.getTopLeft().x;break;case"right":n=r.right-t.getTopRight().x;break;case"centerX":case"center":n=r.centerX-t.getCenter().x;break;default:var c=r.left-t.getTopLeft().x,d=r.right-t.getTopRight().x;n=c<=0&&d>=0?0:Math.abs(c)<=Math.abs(d)?c:d;}}switch(this.scrollMode){case 0:case 1:this.childOY+=n;break;default:this["childO".concat(e)]+=n;}},C_=Phaser.Utils.Objects.GetValue,w_=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={});var r=GS(n),o=C_(n,"panel",void 0);void 0===o&&(o={}),o.scrollMode=r,o.clamplChildOY=C_(n,"clamplChildOY",!1),o.clamplChildOX=C_(n,"clamplChildOX",!1);var a,l,u=new m_(e,o);switch(e.add.existing(u),r){case 0:a=C_(n,"expand.panel",!0),l=!0;break;case 1:a=!0,l=C_(n,"expand.panel",!0);break;default:a=!0,l=!0;}n.type="rexScrollablePanel",n.child={gameObject:u,expandWidth:a,expandHeight:l,align:C_(n,"align.panel","center")};var c=C_(n,"space",void 0);return c&&(c.child=C_(c,"panel",0)),(s=t(this,i,[e,n])).addChildrenMap("panel",u.child),s.addChildrenMap("panelLayer",u.maskLayer),s.addChildrenMap("mask",u.maskGameObject),s.addChildrenMap("scrollableBlock",u),s}return d(i,e),u(i,[{key:"setChildrenInteractive",value:function(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Am(this.childrenMap.child,t),this}}]),i}(HP),S_={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:x_.call(this,t,"y",e);break;case 1:x_.call(this,t,"x",e);break;default:x_.call(this,t,"y",e),x_.call(this,t,"x",e);}return this}};Object.assign(w_.prototype,S_),E.register("scrollablePanel",(function(t){var e=new w_(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.ScrollablePanel",w_);var P_=function(t,e){t.popUp(e);},T_=function(t,e){t.scaleDown(e);},O_=function(t,e){t.fadeIn(e);},M_=function(t,e){t.fadeOut(e);},E_={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},__={setDisplayTime:function(t){return this.displayTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInTime:function(t){return this.transitInTime=t,this},setTransitInCallback:function(t){switch("string"==typeof t&&(t=E_[t]),t){case E_.popUp:t=P_;break;case E_.fadeIn:t=O_;}return t||(t=z),this.transitInCallback=t,this},setTransitOutCallback:function(t){switch("string"==typeof t&&(t=E_[t]),t){case E_.scaleDown:t=T_;break;case E_.fadeOut:t=M_;}return t||(t=z),this.transitOutCallback=t,this}},R_={showMessage:function(t){if(void 0===this.scaleX0&&(this.scaleX0=this.scaleX),void 0===this.scaleY0&&(this.scaleY0=this.scaleY),void 0===t){if(0===this.messages.length)return this;t=this.messages.shift();}if(this.player.isPlaying)return this.messages.push(t),this;this.setScale(this.scaleX0,this.scaleY0).setVisible(!0),"string"==typeof t?this.setText(t):t(this),this.layout();var e=[[0,[this.transitInCallback,this,this.transitInTime]],[0,[this.emit,"transitin",this,this.transitInTime]],[this.transitInTime,[z]],[this.displayTime,[this.transitOutCallback,this,this.transitOutTime]],[0,[this.emit,"transitout",this,this.transitOutTime]],[this.transitOutTime,[this.setVisible,!1]],[30,[z]]];return this.player.load(e,this).once("complete",(function(){this.showMessage();}),this).start(),this},removeAllMessages:function(){return this.messages.length=0,this}},L_=Phaser.Utils.Objects.GetValue,B_=function(e){function i(e,n){var s;return h(this,i),void 0===n&&(n={text:createDefaultTextObject(e)}),(s=t(this,i,[e,n])).type="rexToast",s.setTransitInTime(L_(n,"duration.in",200)),s.setDisplayTime(L_(n,"duration.hold",1200)),s.setTransitOutTime(L_(n,"duration.out",200)),s.setTransitInCallback(L_(n,"transitIn",E_.popUp)),s.setTransitOutCallback(L_(n,"transitOut",E_.scaleDown)),s.player=new Mw(v(s),{dtMode:1}),s.messages=[],s.scaleX0=void 0,s.scaleY0=void 0,s.setVisible(!1),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.player.destroy(),this.player=void 0,this.messages=void 0,m(f(i.prototype),"destroy",this).call(this,t));}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX0=t,this.scaleY0=e,m(f(i.prototype),"setScale",this).call(this,t,e),this}}]),i}(Ix);Object.assign(B_.prototype,__,R_),E.register("toast",(function(t){var e=new B_(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Toast",B_);for(var D_,I_=function(t,e,i){void 0===i&&(i=!0),i?e=e?R(e):{}:e||(e={});var n=new vu(t,e);return t.add.existing(n),n},j_=["AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Blue","BlueViolet","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkGray","DarkGrey","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","DarkOrange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkSlateGrey","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DimGrey","DodgerBlue","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","GoldenRod","Gray","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","LightPink","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateGray","LightSlateGrey","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Magenta","Maroon","MediumAquaMarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenRod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","RebeccaPurple","Red","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","SlateGrey","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","Wheat","White","WhiteSmoke","Yellow","YellowGreen"],z_=[15792383,16444375,65535,8388564,15794175,16119260,16770244,0,16772045,255,9055202,10824234,14596231,6266528,8388352,13789470,16744272,6591981,16775388,14423100,65535,139,35723,12092939,11119017,11119017,25600,12433259,9109643,5597999,16747520,10040012,9109504,15308410,9419919,4734347,3100495,3100495,52945,9699539,16716947,49151,6908265,6908265,2003199,11674146,16775920,2263842,16711935,14474460,16316671,16766720,14329120,8421504,8421504,32768,11403055,15794160,16738740,13458524,4915330,16777200,15787660,15132410,16773365,8190976,16775885,11393254,15761536,14745599,16448210,13882323,13882323,9498256,16758465,16752762,2142890,8900346,7833753,7833753,11584734,16777184,65280,3329330,16445670,16711935,8388608,6737322,205,12211667,9662683,3978097,8087790,64154,4772300,13047173,1644912,16121850,16770273,16770229,16768685,128,16643558,8421376,7048739,16753920,16729344,14315734,15657130,10025880,11529966,14381203,16773077,16767673,13468991,16761035,14524637,11591910,8388736,6697881,16711680,12357519,4286945,9127187,16416882,16032864,3050327,16774638,10506797,12632256,8900331,6970061,7372944,7372944,16775930,65407,4620980,13808780,32896,14204888,16737095,4251856,15631086,16113331,16777215,16119285,16776960,10145074],A_={},F_=0,W_=j_.length;F_<W_;F_++)D_=j_[F_].toLowerCase(),A_[D_]=z_[F_];var V_,Y_=function(t){return "string"!=typeof t||(t.startsWith("#")?t=parseInt(t.substring(1),16):t.startsWith("0x")?t=parseInt(t.substring(2),16):(e=(e=t).toLowerCase(),t=A_.hasOwnProperty(e)?A_[e]:null)),t;var e;},G_=Phaser.Utils.String.Pad,X_=function(t,e){void 0===e&&(e="0x");var i=t.toString(16).toUpperCase();return i=e+(i=G_(i,6,0,1))},H_=Phaser.Utils.Objects.GetValue,U_=Phaser.Utils.Objects.IsPlainObject,N_=Phaser.Math.Clamp,K_=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),n.orientation=0,(s=t(this,i,[e,n])).type="rexColorInputLite";var r,o=H_(n,"background",void 0),a=H_(n,"swatch");U_(a)&&(r=H_(a,"size"));var l,u=function(t,e){if(!1===e)return null;if(Nf(e))return e;var i=new ae(t,e);return t.add.existing(i),i}(e,H_(n,"swatch")),c=H_(n,"inputText",{});if(c&&(l=I_(e,c)),o&&s.addBackground(o),u){var d;void 0!==(r=H_(n,"swatchSize",r))?(uv(u,r,r),d=!1):d=H_(n,"squareExpandSwatch",!0);var f=d?1:0;s.add(u,{proportion:0,expand:!1,fitRatio:f});}if(l){var p=void 0===H_(c,"width")?1:0,g=void 0===H_(c,"height");s.add(l,{proportion:p,expand:g});}s.addChildrenMap("background",o),s.addChildrenMap("swatch",u),s.addChildrenMap("inputText",l),l&&l.on("close",(function(){this.setValue(l.value);}),v(s));var y=H_(n,"valuechangeCallback",null);if(null!==y){var m=H_(n,"valuechangeCallbackScope",void 0);s.on("valuechange",y,m);}return s.setValue(H_(n,"value",0)),s}return d(i,e),u(i,[{key:"value",get:function(){return this._value},set:function(t){if("string"==typeof t){if(null==(t=Y_(t)))return void((e=this.childrenMap.inputText)&&e.setText(X_(this._value)))}else t=N_(Math.floor(t),0,16777215);if(this._value!==t){this._value=t;var e,i=this.childrenMap.swatch;i&&function(t,e){t&&(t.setTint?t.setTint(e):t.setFillStyle&&t.setFillStyle(e));}(i,t),(e=this.childrenMap.inputText)&&e.setText(X_(t)),this.emit("valuechange",this._value);}}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"color",get:function(){return this._value},set:function(t){this.value=t;}},{key:"setColor",value:function(t){return this.color=t,this}}]),i}(Ex),J_={setCreateColorPickerBackgroundCallback:function(t){return this.colorPickerCreateBackgroundCallback=t,this},setColorPickerHPalettePosition:function(t){return this.colorPickerHPalettePosition=t,this},setColorPickerExpandDirection:function(t){return "string"==typeof t&&(t=q_[t]),this.colorPickerExpandDirection=t,this},setColorPickerEaseInDuration:function(t){return void 0===t&&(t=0),this.colorPickerEaseInDuration=t,this},setColorPickerEaseOutDuration:function(t){return void 0===t&&(t=0),this.colorPickerEaseOutDuration=t,this},setColorPickerTransitInCallback:function(t){return this.colorPickerTransitInCallback=t,this},setColorPickerTransitOutCallback:function(t){return this.colorPickerTransitOutCallback=t,this},setColorPickerBounds:function(t){return this.colorPickerBounds=t,this},setColorPickerWidth:function(t){return this.colorPickerWidth=t,this},setColorPickerHeight:function(t){return this.colorPickerHeight=t,this},setColorPickerSize:function(t,e){return this.setColorPickerWidth(t).setColorPickerHeight(e),this},setColorPickerSpace:function(t){return void 0===t&&(t={}),this.colorPickerSpace=t,this},setColorComponentsHeight:function(t){return this.colorComponentsHeight=t,this},setColorComponentsFormatLabelConfig:function(t){return this.colorComponentsFormatLabelConfig=t,this},setColorComponentsInputTextConfig:function(t){return this.colorComponentsInputTextConfig=t,this},setColorComponentsSpace:function(t){return void 0===t&&(t={}),this.colorComponentsSpace=t,this}},q_={down:0,up:1},Z_=Phaser.Display.Color,$_=Phaser.Math.Percent,Q_=Phaser.Display.Color,tR=Phaser.Math.Percent,eR=Phaser.Display.Color.ColorToRGBA,iR=Phaser.Display.Color.HSVToRGB,nR=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=2),void 0===o&&(o=2),(l=t(this,i,[e,n,s,r,o])).type="rexColorPicker.HPaletteCanvas",l.colorObject=new Q_,l.setOrientation(a),l.setSize(r,o),l}return d(i,e),u(i,[{key:"setOrientation",value:function(t){return this.orientation=Tx(t),this}},{key:"updateTexture",value:function(){return function(t,e,i){void 0===i&&(i=!1);var n=t.width,s=t.height,r=new Z_;if(i)for(var o=0;o<s;o++){var a=$_(o,0,s);r.setFromHSV(a,1,1),e.fillStyle=r.rgba,e.fillRect(0,o,n,1);}else for(var h=0;h<n;h++)a=$_(h,0,n),r.setFromHSV(a,1,1),e.fillStyle=r.rgba,e.fillRect(h,0,1,s);}(this.canvas,this.context,this.orientation),m(f(i.prototype),"updateTexture",this).call(this),this}},{key:"color",get:function(){return this.colorObject.color}},{key:"hue",get:function(){return this._hue},set:function(t){this._hue=t;}},{key:"getHue",value:function(t,e){return void 0===t||(0===this.orientation?this.hue=tR(t,0,this.width):this.hue=tR(e,0,this.height)),this.hue}},{key:"getColor",value:function(t,e){if(void 0===t)return this.color;var i=this.getHue(t,e);return this.colorObject.setFromRGB(iR(i,1,1)),this.colorObject.color}},{key:"setColor",value:function(t){return this.color,this}},{key:"colorToLocalPosition",value:function(t,e){return void 0===e?e={}:!0===e&&(void 0===sR&&(sR={}),e=sR),this.colorObject.setFromRGB(eR(t)),0===this.orientation?(e.x=this.width*this.colorObject.h,e.y=this.height/2):(e.x=this.width/2,e.y=this.height*this.colorObject.h),e}}]),i}(Yc),sR=void 0,rR=Phaser.Math.RotateAround,oR=function(t,e,i,n){void 0===n?n={}:!0===n&&(void 0===V_&&(V_={}),n=V_),e-=t.width*t.originX,i-=t.height*t.originY;var s={x:e*t.scaleX,y:i*t.scaleY};return rR(s,0,0,-t.rotation),n.x=t.x+e,n.y=t.y+i,n},aR=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),s=t(this,i,[e,n]);var r=null!=n.width?1:0,o=new nR(e).setOrientation(r);e.add.existing(o),s.type="rexColorPicker.HPalette",o.setInteractive().on("pointerdown",s.onPaletteCanvasPointerDown,v(s)).on("pointermove",s.onPaletteCanvasPointerDown,v(s));var a=new ae(e,{strokeColor:16777215,strokeWidth:2});return e.add.existing(a),s.add(o,{key:"paletteCanvas",expand:!0}).add(a,{key:"marker",expand:!1}),s}return d(i,e),u(i,[{key:"resize",value:function(t,e){if(this.width===t&&this.height===e)return this;m(f(i.prototype),"resize",this).call(this,t,e);var n=Math.min(t,e);return this.childrenMap.marker.setSize(n,n),this}},{key:"onPaletteCanvasPointerDown",value:function(t,e,i,n){if(t.isDown){var s=this.childrenMap.paletteCanvas.getColor(e,i);this.setMarkerPosition(s),this.emit("input",s);}}},{key:"color",get:function(){return this.childrenMap.paletteCanvas.color}},{key:"setColor",value:function(t){return this.color===t||(this.childrenMap.paletteCanvas.setColor(t),this.setMarkerPosition(t)),this}},{key:"setMarkerPosition",value:function(t){var e=this.childrenMap.paletteCanvas,i=this.childrenMap.marker,n=e.colorToLocalPosition(t,!0);return oR(e,n.x,n.y,i),this.resetChildPositionState(i),this}},{key:"getHue",value:function(t,e){return this.childrenMap.paletteCanvas.getHue(t,e)}}]),i}(rk),hR=Phaser.Display.Color,lR=Phaser.Math.Percent,uR=Phaser.Display.Color.ColorToRGBA,cR=Phaser.Display.Color.HSVToRGB,dR=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=2),void 0===o&&(o=2),(l=t(this,i,[e,n,s,r,o])).type="rexColorPicker.SVPaletteCanvas",void 0===a&&(a=1),l.colorObject=new hR,l.setHue(a),l.setSize(r,o),l}return d(i,e),u(i,[{key:"color",get:function(){return this.colorObject.color}},{key:"hue",get:function(){return this._hue},set:function(t){this._hue!==t&&(this._hue=t,this.colorObject.h=t,this.dirty=!0);}},{key:"setHue",value:function(t){return this.hue=t,this}},{key:"updateTexture",value:function(){return function(t,e,i){for(var n=t.width,s=t.height,r=e.getImageData(0,0,n,s),o=r.data,a=new Z_,h=0;h<s;h++)for(var l=0;l<n;l++){var u=$_(l,0,n),c=1-$_(h,0,s);a.setFromHSV(i,u,c);var d=4*(h*n+l);o[d]=a.red,o[d+1]=a.green,o[d+2]=a.blue,o[d+3]=255;}e.putImageData(r,0,0);}(this.canvas,this.context,this.hue),m(f(i.prototype),"updateTexture",this).call(this),this}},{key:"getColor",value:function(t,e){if(void 0===t)return this.colorObject.color;var i=lR(t,0,this.width),n=1-lR(e,0,this.height);return this.colorObject.setFromRGB(cR(this.hue,i,n)),this.colorObject.color}},{key:"setColor",value:function(t){return this.color===t||(this.colorObject.setFromRGB(uR(t)),this.setHue(this.colorObject.h)),this}},{key:"colorToLocalPosition",value:function(t,e){return void 0===e?e={}:!0===e&&(void 0===fR&&(fR={}),e=fR),this.colorObject.setFromRGB(uR(t)),e.x=this.width*this.colorObject.s,e.y=this.height*(1-this.colorObject.v),e}}]),i}(Yc),fR=void 0,pR=function(e){function i(e,n){var s;h(this,i),s=t(this,i,[e,n]);var r=new dR(e);e.add.existing(r),s.type="rexColorPicker.SVPalette",r.setInteractive().on("pointerdown",s.onPaletteCanvasPointerDown,v(s)).on("pointermove",s.onPaletteCanvasPointerDown,v(s));var o=new ae(e,{radius:5,strokeColor:16777215,strokeWidth:2});return e.add.existing(o),s.add(r,{key:"paletteCanvas",expand:!0}).add(o,{key:"marker",expand:!1}),s}return d(i,e),u(i,[{key:"onPaletteCanvasPointerDown",value:function(t,e,i,n){if(t.isDown){var s=this.childrenMap.paletteCanvas.getColor(e,i);this.setMarkerPosition(s),this.emit("input",s);}}},{key:"color",get:function(){return this.childrenMap.paletteCanvas.color}},{key:"setHue",value:function(t){return this.childrenMap.paletteCanvas.setHue(t),this}},{key:"setColor",value:function(t){return this.color===t||(this.childrenMap.paletteCanvas.setColor(t),this.setMarkerPosition(t)),this}},{key:"setMarkerPosition",value:function(t){var e=this.childrenMap.paletteCanvas,i=this.childrenMap.marker,n=e.colorToLocalPosition(t,!0);return oR(e,n.x,n.y,i),this.resetChildPositionState(i),this}}]),i}(rk),vR=Phaser.Utils.Objects.GetValue,gR=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).type="rexColorPicker",s.freezePalettes=!1;var r=vR(n,"hPalette.position",0);"string"==typeof r&&(r=yR[r]);var o=0===r||2===r?1:0;s.setOrientation(o);var a,l,u=vR(n,"background",void 0);0===s.orientation?void 0===(l=vR(n,"hPalette.width",void 0))&&(l=vR(n,"hPalette.size",10)):void 0===(a=vR(n,"hPalette.height",void 0))&&(a=vR(n,"hPalette.size",10));var c=new aR(e,{width:l,height:a});e.add.existing(c);var d=vR(n,"svPalette.width",void 0),f=vR(n,"svPalette.height",void 0),p=new pR(e,{width:d,height:f});e.add.existing(p),u&&s.addBackground(u);var g,y,m={proportion:0,expand:!0};0===s.orientation?(g=void 0===d?1:0,y=void 0===f):(g=void 0===f?1:0,y=void 0===d);var k={proportion:g,expand:y};0===r||3===r?s.add(p,k).add(c,m):s.add(c,m).add(p,k),c.on("input",(function(){p.setHue(c.getHue()),this.setValue(p.color,!0);}),v(s)),p.on("input",(function(){this.setValue(p.color,!0);}),v(s)),s.addChildrenMap("background",u),s.addChildrenMap("hPalette",c),s.addChildrenMap("svPalette",p);var b=vR(n,"valuechangeCallback",null);if(null!==b){var x=vR(n,"valuechangeCallbackScope",void 0);s.on("valuechange",b,x);}return s.setValue(vR(n,"value",16777215)),s}return d(i,e),u(i,[{key:"value",get:function(){return this._value},set:function(t){if(this._value!==t){var e=this._value;this._value=t,this.freezePalettes||this.updatePalettes(),this.emit("valuechange",t,e,this);}}},{key:"setValue",value:function(t,e){return this.freezePalettes=!!e,this.value=t,this.freezePalettes=!1,this}},{key:"color",get:function(){return this._value},set:function(t){this.value=t;}},{key:"setColor",value:function(t){return this.color=t,this}},{key:"updatePalettes",value:function(){return this.childrenMap.hPalette.setColor(this.color),this.childrenMap.svPalette.setColor(this.color),this}},{key:"postLayout",value:function(t,e,i){return this.childrenMap.hPalette.setMarkerPosition(this.value),this.childrenMap.svPalette.setMarkerPosition(this.value),this}}]),i}(Ex),yR={bottom:0,left:1,top:2,right:3},mR=Phaser.Utils.Objects.GetValue,kR=Phaser.Display.Color,bR=Phaser.Display.Color.ColorToRGBA,xR=Phaser.Display.Color.HSVToRGB,CR=Phaser.Math.Clamp,wR=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),n.orientation=0,(s=t(this,i,[e,n])).type="rexColorComponents",s.colorObject=new kR;var r=mR(n,"background",void 0),o=mR(n,"formatLabel",void 0);Nf(o)||(o=_S(e,o).resetDisplayContent());var a=[];if(n.inputText0&&n.inputText1&&n.inputText2)a.push(n.inputText0),a.push(n.inputText1),a.push(n.inputText2);else for(var l=mR(n,"inputText"),u=0;u<3;u++){var c=I_(e,l).setMaxLength(3).setNumberInput();a.push(c);}r&&s.addBackground(r);var d=mR(n,"proportion.formatLabel",0),f=!!o.isRexContainerLite,p=mR(n,"expand.formatLabel",f);s.add(o,{proportion:d,expand:p});d=void 0===mR(l,"width")?1:0,p=void 0===mR(l,"height"),u=0;for(var g=a.length;u<g;u++)s.add(a[u],{proportion:d,expand:p});s.addChildrenMap("background",r),s.addChildrenMap("formatLabel",o),s.addChildrenMap("components",a),s.onClick(o,s.toggleColorFormat,v(s));for(u=0,g=a.length;u<g;u++)a[u].on("close",(function(){this.updateColorObject(),this.setValue(this.colorObject.color);}),v(s));var y=mR(n,"valuechangeCallback",null);if(null!==y){var m=mR(n,"valuechangeCallbackScope",void 0);s.on("valuechange",y,m);}return o.setText("RGB"),s.setValue(mR(n,"value",16777215)),s}return d(i,e),u(i,[{key:"value",get:function(){return this._value},set:function(t){t=CR(Math.floor(t),0,16777215),this._value!==t&&(this._value=t,this.colorObject.setFromRGB(bR(t)),this.updateComponents(),this.emit("valuechange",this._value));}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"color",get:function(){return this._value},set:function(t){this.value=t;}},{key:"setColor",value:function(t){return this.color=t,this}},{key:"colorFormat",get:function(){return this.childrenMap.formatLabel.text},set:function(t){this.colorFormat!==t&&(this.childrenMap.formatLabel.setText(t),this.updateComponents());}},{key:"setColorFormat",value:function(t){return this.colorFormat=t,this}},{key:"toggleColorFormat",value:function(){return this.colorFormat="RGB"===this.colorFormat?"HSV":"RGB",this}},{key:"updateComponents",value:function(){var t,e,i,n=this.childrenMap.components;return "RGB"===this.colorFormat?(t=this.colorObject.red,e=this.colorObject.green,i=this.colorObject.blue):(t=Math.floor(360*this.colorObject.h),e=Math.floor(100*this.colorObject.s),i=Math.floor(100*this.colorObject.v)),n[0].setValue(t),n[1].setValue(e),n[2].setValue(i),this}},{key:"updateColorObject",value:function(){var t=this.childrenMap.components;if("RGB"===this.colorFormat){var e=CR(t[0].value,0,255),i=CR(t[1].value,0,255),n=CR(t[2].value,0,255);this.colorObject.setTo(e,i,n);}else {var s=CR(t[0].value,0,359)/360,r=CR(t[1].value,0,100)/100,o=CR(t[2].value,0,100)/100;this.colorObject.setFromRGB(xR(s,r,o));}return this}}]),i}(Ex),SR=Phaser.Utils.Objects.GetValue,PR=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),n.orientation=1,(s=t(this,i,[e,n])).type="rexColorInput.ColorPickerPanel";var r,o=SR(n,"background",void 0),a=new gR(e,{hPalette:n.hPalette||{},svPalette:n.svPalette||{},space:{item:SR(n,"space.hPalette",8)}});return e.add.existing(a),n.colorComponents&&(r=new wR(e,n.colorComponents),e.add.existing(r)),o&&(s.addBackground(o),new Og(o,{stopAllLevels:!1})),s.add(a,{proportion:1,expand:!0}),r&&s.add(r,{proportion:0,expand:!0}),s.addChildrenMap("background",o),s.addChildrenMap("colorPicker",a),s.addChildrenMap("colorComponents",r),a.on("valuechange",(function(t){this.setValue(t);}),v(s)),r&&r.on("valuechange",(function(t){this.setValue(t);}),v(s)),s.setValue(SR(n,"value",16777215)),s}return d(i,e),u(i,[{key:"value",get:function(){return this._value},set:function(t){if(this._value!==t){this._value=t,this.childrenMap.colorPicker.setValue(t);var e=this.childrenMap.colorComponents;e&&e.setValue(t),this.emit("valuechange",t);}}},{key:"setValue",value:function(t){return this.value=t,this}}]),i}(Ex);Phaser.Utils.Objects.GetValue;var TR=function(t){t=this.scene;var e,i=this.colorPickerCreateBackgroundCallback;i&&(e=i.call(this,t),t.add.existing(e));var n=this.colorPickerWidth;void 0===n&&(n=this.width);var s,r=this.colorPickerHeight;void 0===r&&(r=n),s=this.colorComponentsHeight>0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var o=new PR(t,{width:n,height:r,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:s,value:this.value});return t.add.existing(o),o},OR={openColorPicker:function(){if(!this.colorPicker){var t=TR.call(this).layout(),e=new KO(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t);}),this);}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0;}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(OR,J_);var MR=Phaser.Utils.Objects.GetValue,ER=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),(s=t(this,i,[e,n])).type="rexColorInput",n.hasOwnProperty("colorPicker")||(n.colorPicker={background:{color:0}});var r=n.colorPicker,o=!1!==r&&null!==r;if(o){var a;s.setColorPickerSize(MR(r,"width",160),MR(r,"height",170));var l=MR(r,"background");a=l?function(t){return ZC(t,l)}:MR(r,"createBackgroundCallback"),s.setCreateColorPickerBackgroundCallback(a),s.setColorPickerHPalettePosition(MR(r,"hPalettePosition",0)),s.setColorPickerExpandDirection(MR(r,"expandDirection")),s.setColorPickerEaseInDuration(MR(r,"easeIn",200)),s.setColorPickerEaseOutDuration(MR(r,"easeOut",200)),s.setColorPickerTransitInCallback(MR(r,"transitIn")),s.setColorPickerTransitOutCallback(MR(r,"transitOut")),s.setColorPickerBounds(MR(r,"bounds"));var u=MR(r,"space");void 0===u&&(u={left:10,right:10,top:10,bottom:10,item:8}),s.setColorPickerSpace(u);}var c=n.colorComponents;if(o&&(!1!==c&&null!==c)){s.setColorComponentsHeight(MR(c,"height",30)),s.setColorComponentsFormatLabelConfig(MR(c,"formatLabel"));var d=MR(c,"inputText");d||(d=MR(n,"inputText")),s.setColorComponentsInputTextConfig(d);var f=MR(c,"space");void 0===f&&(f={item:8}),s.setColorComponentsSpace(f);}var p=s.childrenMap.swatch;return p&&o&&s.onClick(p,s.openColorPicker,v(s)),s}return d(i,e),u(i)}(K_);Object.assign(ER.prototype,OR),E.register("colorInput",(function(t){var e=new ER(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.ColorInput",ER),E.register("colorInputLite",(function(t){var e=new K_(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.ColorInputBase",K_),E.register("colorPicker",(function(t){var e=new gR(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.ColorPicker",gR),E.register("colorComponents",(function(t){var e=new wR(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.ColorComponents",wR);var _R=function(t){for(var e,i=t.scene.input,n=i.manager,s=n.pointersTotal,r=n.pointers,o=0;o<s;o++)if((e=r[o]).primaryDown&&0===i.getDragState(e)&&Tl(t,e))return i.setDragState(e,1),i._drag[e.id]=[t],0===i.dragDistanceThreshold||0===i.dragTimeThreshold?(i.setDragState(e,3),i.processDragStartList(e)):i.setDragState(e,2),!0;return !1},RR=Phaser.Utils.Objects.GetValue,LR=Phaser.Math.Distance.Between,BR=Phaser.Math.RotateAroundDistance,DR=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,{eventEmitter:!1}]))._enable=void 0,e.setInteractive(RR(n,"inputConfig",void 0)),s.resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.setEnable(RR(t,"enable",!0)),this.setAxisMode(RR(t,"axis",0)),this.setAxisRotation(RR(t,"rotation",0)),this}},{key:"toJSON",value:function(){return {enable:this.enable,axis:this.axisMode,rotation:this.axisRotation}}},{key:"boot",value:function(){var t=this.parent;t.on("dragstart",this.onDragStart,this),t.on("drag",this.onDrag,this),t.on("dragend",this.onDragEnd,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.pointer=void 0,m(f(i.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragend(),this._enable=t,this.scene.input.setDraggable(this.parent,t),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=IR[t]),this.axisMode=t,this}},{key:"setAxisRotation",value:function(t){return this.axisRotation=t,this}},{key:"drag",value:function(){return _R(this.parent),this}},{key:"dragend",value:function(){if(this.isDragging)return this.scene.input.setDragState(this.pointer,5),this}},{key:"onDragStart",value:function(t,e,i){this.isDragging||(this.pointer=t);}},{key:"onDrag",value:function(t,e,i){if(this.pointer===t){var n=this.parent;if(0===this.axisMode)n.x=e,n.y=i;else if(0===this.axisRotation)1===this.axisMode?n.x=e:2===this.axisMode&&(n.y=i);else {var s,r={x:e,y:i};s=LR(r.x,r.y,n.x,n.y),r=BR(r,n.x,n.y,-this.axisRotation,s),1===this.axisMode?r.y=n.y:2===this.axisMode&&(r.x=n.x),s=LR(r.x,r.y,n.x,n.y),r=BR(r,n.x,n.y,this.axisRotation,s),n.x=r.x,n.y=r.y;}}}},{key:"onDragEnd",value:function(t,e,i,n){this.pointer===t&&(this.pointer=void 0);}},{key:"isDragging",get:function(){return void 0!==this.pointer}}]),i}(mo),IR={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},jR=function(){var t=this.sizerChildren[0],e=this.sizerChildren[1],i=this.sizerChildren[2],n=this.getSizerConfig(t).padding,s=this.getSizerConfig(e).padding,r=this.getSizerConfig(i).padding;if(0===this.orientation){var o=this.innerLeft+n.left,a=this.innerRight-r.right,h=Vr(e),l=e.x+h*(0-e.originX),u=e.x+h*(1-e.originX),c=l-s.left-this.space.item-n.right-o,d=a-(u+s.right+this.space.item+r.left),f=c+d;this.minFirstChildSize>0&&c<this.minFirstChildSize&&(d=f-(c=this.minFirstChildSize)),this.minSecondChildSize>0&&d<this.minSecondChildSize&&(c=f-(d=this.minSecondChildSize)),this.setSplitRatio(c/f);}else {var p=this.innerTop+n.top,v=this.innerBottom-r.bottom,g=Yr(e),y=e.y+g*(0-e.originY),m=e.y+g*(1-e.originY),k=y-s.top-this.space.item-n.bottom-p,b=v-(m+s.bottom+this.space.item+r.top),x=k+b;this.minFirstChildSize>0&&k<this.minFirstChildSize&&(b=x-(k=this.minFirstChildSize)),this.minSecondChildSize>0&&b<this.minSecondChildSize&&(k=x-(b=this.minSecondChildSize)),this.setSplitRatio(k/x);}var C=this.minWidth,w=this.minHeight;this.setMinSize(this.width,this.height).layout().setMinSize(C,w);},zR=Phaser.Utils.Objects.GetValue,AR=Phaser.Math.Clamp,FR=function(e){function i(e,n){var s;h(this,i),n.hasOwnProperty("orientation")||(n.orientation=n.hasOwnProperty("leftPanel")?0:1),(s=t(this,i,[e,n])).type="rexSplit";var r,o,a,l,u=zR(n,"background",void 0);0===s.orientation?(r="leftPanel",o="rightPanel",a="minLeftPanelWidth",l="minRightPanelWidth"):(r="topPanel",o="bottomPanel",a="minTopPanelHeight",l="minBottomPanelHeight");var c=zR(n,r,void 0),d=zR(n,"splitter",void 0),f=zR(n,o,void 0);u&&s.addBackground(u);var p=zR(n,"space",void 0);return s.add(c,{proportion:1,expand:!0,padding:{left:zR(p,"".concat(r,"Left"),0),right:zR(p,"".concat(r,"Right"),0),top:zR(p,"".concat(r,"Top"),0),bottom:zR(p,"".concat(r,"Bottom"),0)}}),s.add(d,{proportion:0,expand:!0,padding:{left:zR(p,"splitterLeft",0),right:zR(p,"splitterRight",0),top:zR(p,"splitterTop",0),bottom:zR(p,"splitterBottom",0)}}),s.add(f,{proportion:1,expand:!0,padding:{left:zR(p,"".concat(o,"Left"),0),right:zR(p,"".concat(o,"Right"),0),top:zR(p,"".concat(o,"Top"),0),bottom:zR(p,"".concat(o,"Bottom"),0)}}),s.addChildrenMap("background",u),s.addChildrenMap(r,c),s.addChildrenMap("splitter",d),s.addChildrenMap(o,f),s.minFirstChildSize=zR(n,a,0),s.minSecondChildSize=zR(n,l,0),s.setSplitRatio(zR(n,"splitRatio",.5)),s.splitterDragBehavior=new DR(d,{axis:0===s.orientation?1:2}),d.on("dragstart",(function(){this.emit("splitter.dragstart",d,this.splitRatio);}),v(s)).on("dragend",(function(){this.emit("splitter.dragend",d,this.splitRatio);}),v(s)).on("drag",(function(){jR.call(this),this.emit("splitter.drag",d,this.splitRatio);}),v(s)).on("pointerover",(function(){this.emit("splitter.over",d,this.splitRatio);}),v(s)).on("pointerout",(function(){this.emit("splitter.out",d,this.splitRatio);}),v(s)),s}return d(i,e),u(i,[{key:"splitterEnable",get:function(){return this.splitterDragBehavior.enable},set:function(t){this.splitterDragBehavior.setEnable(t);}},{key:"setSplitterEnable",value:function(t){return void 0===t&&(t=!0),this.splitterEnable=t,this}},{key:"minLeftPanelWidth",get:function(){return this.minFirstChildSize},set:function(t){this.minFirstChildSize=t;}},{key:"minRightPanelWidth",get:function(){return this.minSecondChildSize},set:function(t){this.minSecondChildSize=t;}},{key:"minTopPanelHeight",get:function(){return this.minFirstChildSize},set:function(t){this.minFirstChildSize=t;}},{key:"minBottomPanelHeight",get:function(){return this.minSecondChildSize},set:function(t){this.minSecondChildSize=t;}},{key:"setMinLeftPanelWidth",value:function(t){return this.minLeftPanelWidth=t,this}},{key:"setMinRightPanelWidth",value:function(t){return this.minRightPanelWidth=t,this}},{key:"setMinTopPanelHeight",value:function(t){return this.minTopPanelHeight=t,this}},{key:"setMinBottomPanelHeight",value:function(t){return this.minBottomPanelHeight=t,this}},{key:"splitRatio",get:function(){return this._splitRatio},set:function(t){t=AR(t,0,1),this._splitRatio!==t&&(this._splitRatio=t,this.getSizerConfig(this.sizerChildren[0]).proportion=t,this.getSizerConfig(this.sizerChildren[2]).proportion=1-t);}},{key:"setSplitRatio",value:function(t){return this.splitRatio=t,this}}]),i}(Ex);E.register("splitPanels",(function(t){var e=new FR(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.SplitPanels",FR);var WR=function(t,e){return function(i,n,s,r){"panel"!==n&&s.moveChild(i,r?0:t,e);}},VR=function(t,e){return function(i,n,s,r){"panel"===n&&s.moveChild(i,r?0:t,e);}},YR={visible:{show:function(){return function(t,e,i,n){"panel"!==e&&i.setChildVisible(t,!0);}},hide:function(){return function(t,e,i,n){"panel"!==e&&i.setChildVisible(t,!1);}}},fade:{show:function(t,e){return void 0===e&&(e=1),function(i,n,s,r){"panel"!==n&&s.fadeChild(i,r?0:t,e);}},hide:function(t,e){return void 0===e&&(e=0),function(i,n,s,r){"panel"!==n&&s.fadeChild(i,r?0:t,e);}}},move:{show:WR,hide:WR},"move-panel":{show:VR,hide:VR}},GR=ip.prototype.setChildVisible,XR={setChildVisible:function(t,e){if("string"==typeof t){var i=t;t=this.sizerChildren[i];}else i=ik(this.sizerChildren,t);return void 0===e&&(e=this.currentChildKey===i),GR.call(this,t,e),this}},HR={fadeChild:function(t,e,i){var n;return "string"==typeof t?(n=t,t=this.sizerChildren[n]):n=ik(this.sizerChildren,t),void 0===e&&(e=500),void 0===i&&(i=this.currentChildKey===n?1:0),t.fadeIn(e,{start:t.alpha,end:i}),this},fadeChildPromise:function(t,e,i){return "string"==typeof t&&(t=this.sizerChildren[key]),this.fadeChild(t,e,i),t._fade?jh(t._fade):Promise.resolve()}},UR={moveChild:function(t,e,i,n){var s;"string"==typeof t?(s=t,t=this.sizerChildren[s]):s=ik(this.sizerChildren,t),void 0===e&&(e=500);var r,o,a,h,l=this.currentChildKey===s;if(void 0===n)switch(s){case"leftSide":case"rightSide":n=Vr(t);break;case"topSide":case"bottomSide":n=Yr(t);break;default:if(l)switch(this.previousChildKey){case"leftSide":case"rightSide":n=Vr(this.sizerChildren[this.previousChildKey]);break;case"topSide":case"bottomSide":n=Yr(this.sizerChildren[this.previousChildKey]);break;default:n=0;}else switch(this.currentChildKey){case"leftSide":case"rightSide":n=Vr(this.sizerChildren[this.currentChildKey]);break;case"topSide":case"bottomSide":n=Yr(this.sizerChildren[this.currentChildKey]);break;default:n=0;}}if(l)switch(s){case"panel":switch(this.previousChildKey){case"leftSide":r=!0;break;case"rightSide":o=!0;break;case"topSide":a=!0;break;case"bottomSide":h=!0;}break;case"leftSide":o=!0;break;case"rightSide":r=!0;break;case"topSide":h=!0;break;case"bottomSide":a=!0;}else switch(s){case"panel":switch(this.currentChildKey){case"leftSide":o=!0;break;case"rightSide":r=!0;break;case"topSide":h=!0;break;case"bottomSide":a=!0;}break;case"leftSide":r=!0;break;case"rightSide":o=!0;break;case"topSide":a=!0;break;case"bottomSide":h=!0;}return r?t.moveTo(e,"-=".concat(n),void 0,i):o?t.moveTo(e,"+=".concat(n),void 0,i):a?t.moveTo(e,void 0,"-=".concat(n),i):h?t.moveTo(e,void 0,"+=".concat(n),i):t.moveTo(0),this},moveChildPromise:function(t,e,i,n){return "string"==typeof t&&(t=this.sizerChildren[key]),this.moveChild(t,e,i,n),t._easeMove?jh(t._easeMove):Promise.resolve()}},NR={};Object.assign(NR,XR,HR,UR);var KR=Phaser.Utils.Objects.GetValue,JR=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).type="rexSides",s.childrenMap=s.sizerChildren,s.previousChildKey=void 0,s.currentChildKey=void 0;var r=KR(n,"showChildCallback",void 0);if(r)if(Gg(r)){var o=KR(n,"showChildCallbackScope",void 0);s.on("showchild",r,o);var a=KR(n,"hideChildCallback",void 0),l=KR(n,"hideChildCallbackScope",void 0);s.on("hidechild",a,l);}else {var u=function(t){var e,i,n,s,r=C("string"==typeof t?[t]:t);return e=r[0],i=r.slice(1),YR.hasOwnProperty(e)?(n=YR[e].show.apply(null,i),s=YR[e].hide.apply(null,i)):(n=z,s=z),{show:n,hide:s}}(r);s.on("showchild",u.show),s.on("hidechild",u.hide);}var c=KR(n,"background",void 0),d=KR(n,"panel",void 0),f=KR(n,"leftSide",void 0),p=KR(n,"rightSide",void 0),v=KR(n,"topSide",void 0),g=KR(n,"bottomSide",void 0);if(c&&s.addBackground(c),d&&s.add(d,"panel","center",0,!0),f){var y=KR(n,"expand.left",!0);s.add(f,"leftSide","left-top",0,{height:y});}if(p){y=KR(n,"expand.right",!0);s.add(p,"rightSide","right-top",0,{height:y});}if(v){y=KR(n,"expand.top",!0);s.add(v,"topSide","left-top",0,{width:y});}if(g){y=KR(n,"expand.bottom",!0);s.add(g,"bottomSide","left-bottom",0,{width:y});}return s}return d(i,e),u(i,[{key:"reset",value:function(){return this.previousChildKey=void 0,this.currentChildKey="panel",this.showChild("panel",!0),this.hideChild("leftSide",!0),this.hideChild("rightSide",!0),this.hideChild("topSide",!0),this.hideChild("bottomSide",!0),this}}]),i}(rk);Object.assign(JR.prototype,{showChild:function(t,e){var i=this.sizerChildren[t];return i&&(this.emit("showchild",i,t,this,e),this.resetChildState(i)),this},hideChild:function(t,e){var i=this.sizerChildren[t];return i&&(this.emit("hidechild",i,t,this,e),this.resetChildState(i)),this},swapChild:function(t,e){return this.currentChildKey===t||("panel"===this.currentChildKey||"panel"===t?(this.previousChildKey=this.currentChildKey,this.currentChildKey=t,this.hideChild(this.previousChildKey,e),this.showChild(this.currentChildKey,e)):(this.swapChild("panel",e),this.swapChild(t,e))),this},showPanel:function(t){return this.swapChild("panel",t),this},showLeftSide:function(){return this.swapChild("leftSide"),this},showRightSide:function(){return this.swapChild("rightSide"),this},showTopSide:function(){return this.swapChild("topSide"),this},showBottomSide:function(){return this.swapChild("bottomSide"),this},hideLeftSide:function(){return "leftSide"==this.currentChildKey&&this.showPanel(),this},hideRightSide:function(){return "rightSide"==this.currentChildKey&&this.showPanel(),this},hideTopSide:function(){return "topSide"==this.currentChildKey&&this.showPanel(),this},hideBottomSide:function(){return "bottomSide"==this.currentChildKey&&this.showPanel(),this},toggleLeftSide:function(){var t="panel"!==this.currentChildKey?"panel":"leftSide";return this.swapChild(t),this},toggleRightSide:function(){var t="panel"!==this.currentChildKey?"panel":"rightSide";return this.swapChild(t),this},toggleTopSide:function(){var t="panel"!==this.currentChildKey?"panel":"topSide";return this.swapChild(t),this},toggleBottomSide:function(){var t="panel"!==this.currentChildKey?"panel":"bottomSide";return this.swapChild(t),this}},NR),E.register("sides",(function(t){var e=new JR(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Sides",JR);var qR=Phaser.Utils.Array.GetFirst,ZR=Phaser.Utils.Array.Remove,$R=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n=hw(e,n)])).type="rexTweaker.Title",s}return d(i,e),u(i,[{key:"setTitle",value:function(t){return (t=t?R(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}]),i}(Ix),QR=function(e){function i(e,n){var s;h(this,i),void 0===n&&(n={}),(s=t(this,i,[e,n])).type="rexTweaker.FolderTitle";var r=new Gd(e,n.expandedIcon);return e.add.existing(r),s.addSpace().add(r,{proportion:0,expand:!1,padding:1,fitRatio:1}),s.addChildrenMap("expandedIcon",r),s}return d(i,e),u(i,[{key:"setExpandedState",value:function(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}}]),i}($R),tL=function(t,e){var i=new PL(t,e);return t.add.existing(i),i},eL=function(t,e,i){return ZC(t,i)},iL=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).type="rexTweaker.Folder",s}return d(i,e),u(i,[{key:"setTitle",value:function(t){return this.childrenMap.title.setTitle(t),this}}]),i}(WE);Object.assign(iL.prototype,{setBindingTarget:function(t){return this.childrenMap.child.setBindingTarget(t),this}},{getMaxInputRowTitleWidth:function(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth:function(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}});var nL=Phaser.Utils.Objects.GetValue,sL=Phaser.Utils.Objects.GetValue,rL={getMaxInputRowTitleWidth:function(){for(var t=0,e=this.childrenMap.pages.children,i=0,n=e.length;i<n;i++)t=Math.max(t,e[i].getMaxInputRowTitleWidth());return t+this.getInnerPadding("left")},setInputRowTitleWidth:function(t){t-=this.getInnerPadding("left");for(var e=this.childrenMap.pages.children,i=0,n=e.length;i<n;i++)e[i].setInputRowTitleWidth(t);return this}},oL=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).type="rexTweaker.TabPages",s}return d(i,e),u(i)}(BE);Object.assign(oL.prototype,{setBindingTarget:function(t){for(var e=this.childrenMap.pages.children,i=0,n=e.length;i<n;i++)e[i].setBindingTarget(t);return this}},rL);var aL=Phaser.Utils.Objects.GetValue,hL=Phaser.Utils.Objects.GetValue,lL=Phaser.Utils.Objects.GetValue,uL={setupBinding:function(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t);}),this),this},setAutoUpdateEnable:function(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget:function(t,e){return this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue(),this},setBindingTargetKey:function(t){return this.bindTargetKey=t,this},setValueCallbacks:function(t){return this.onGetValue=lL(t,"onGetValue"),this.onSetValue=lL(t,"onSetValue"),this},getTargetValue:function(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue:function(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue:function(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},cL=Phaser.Utils.Objects.GetValue,dL=function(e){function i(e,n){var s;h(this,i),(s=t(this,i,[e,n])).type="rexTweaker.InputRow",s.bindingTarget=void 0,s.bindTargetKey=void 0,s.autoUpdateEnable=!0;var r,o=n.inputTitle,a=n.inputField,l=n.background,u=cL(n,"proportion.title",0),c=cL(n,"space.title",0);r=0===s.orientation?{right:c}:{bottom:c},s.add(o,{proportion:u,expand:!0,padding:r});var d=a.defaultProportion;void 0===d&&(d=1===n.parentOrientation?1:0);u=cL(n,"proportion.inputField",d);return s.add(a,{proportion:u,expand:!0}),l&&s.addBackground(l),s.addChildrenMap("title",o),s.addChildrenMap("inputField",a),s.addChildrenMap("background",l),s.setupBinding(),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),m(f(i.prototype),"destroy",this).call(this,t));}},{key:"setTitle",value:function(t){return this.childrenMap.title.setTitle(t),this}},{key:"preLayout",value:function(){var t=this.childrenMap.title;t&&(t.minWidth=0),m(f(i.prototype),"preLayout",this).call(this);}}]),i}(Ex);Object.assign(dL.prototype,uL,{startMonitorTarget:function(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget:function(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget:function(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t);}}},{getMinTitleWidth:function(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+e.left+e.right+this.getInnerPadding("left")},setMinTitleWidth:function(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=i.left+i.right,e.minWidth=t,this}});var fL=function(t,e,i){var n=new $R(t,i);return t.add.existing(n),n},pL=function(e){void 0===e&&(e=Ex);var i=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"bindingTarget",get:function(){return this.getParentSizer().bindingTarget}},{key:"bindingKey",get:function(){return this.getParentSizer().bindTargetKey}},{key:"value",get:function(){return this._value},set:function(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;this._value=t,this.syncValueFlag||this.emit("valuechange",t,e,this.bindingTarget,this.bindingKey);}}},{key:"validate",value:function(t){return !(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}},{key:"getFotmatText",value:function(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}},{key:"getValue",value:function(){return this.value}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"syncValue",value:function(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}},{key:"setup",value:function(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}},{key:"setSetupCallback",value:function(t){return this.setupCallback=t,this}},{key:"setDisplayValueCallback",value:function(t){return this.displayValueCallback=t,this}},{key:"setTextFormatCallback",value:function(t){return this.textFormatCallback=t,this}},{key:"setValidateCallback",value:function(t){return this.validateCallback=t,this}}]),i}(e);return i},vL=function(t,e,i){for(var n,s=this.inputHandlers,r=0,o=s.length;r<o;r++){var a=s[r];if(a.accept(e)){n=new(pL(a.baseClass))(t),t.add.existing(n),n.setSetupCallback(a.setup).setDisplayValueCallback(a.displayValue),a.build(n,i);break}}return n&&n.setup(e,!0),n},gL=Phaser.Utils.Objects.GetValue,yL=function(t,e,i){var s=vL.call(this,t,e,i);if(!s)return null;var r=gL(i,"title")||{},o=fL(t,0,r),a=gL(i,"background")||{},h=ZC(t,a),l=new dL(t,n(n(n({},i),e),{},{inputTitle:o,inputField:s,background:h}));return t.add.existing(l),l.setTitle(e),l.setValueCallbacks(e),l},mL=Phaser.Utils.Objects.GetValue,kL=Phaser.Utils.Objects.GetValue,bL=function(t,e,i){for(var s=kL(i,"title")||{},r=fL(t,0,s),o=e.buttons,a=kL(i,"button")||{},h=[],l=0,u=o.length;l<u;l++){var c=_S(t,a);h.push(c);var d=o[l];c.resetDisplayContent(d.label),c.callback=d.callback;}var f=function(t,e){var i=new(mL(e,"wrap",!1)?kS:iS)(t,e);return t.add.existing(i),i}(t,{buttons:h,expand:!0,wrap:kL(e,"wrap",!1)});f.defaultProportion=1;var p=function(t,e){var i=new ae(t,e);return t.add.existing(i),i}(t,kL(i,"background")||{}),v=new dL(t,n(n({},i),{},{inputTitle:r,inputField:f,background:p}));return t.add.existing(v),v.setTitle(e),f.on("button.click",(function(t){t.callback(v.bindingTarget);})),v},xL=Phaser.Utils.Objects.GetValue,CL=Phaser.Utils.Objects.GetValue,wL={registerInputHandler:function(t){var e=!0;return t.hasOwnProperty("accept")||(e=!1,console.error("[Tweaker] Can't register inputHandler '".concat(t.name,"', missing 'accept' callback."))),t.hasOwnProperty("build")||(e=!1,console.error("[Tweaker] Can't register inputHandler '".concat(t.name,"', missing 'build' callback."))),e&&this.inputHandlers.unshift(t),this},removeInputHandler:function(t){var e=qR(this.inputHandlers,"name",t);return e&&ZR(this.inputHandlers,e),this},addFolder:function(t){var e=this.scene,i=sL(this.styles,"folder")||{};i.tweaker=this.styles,i.root=this.root;var n=function(t,e,i){var n=nL(i,"title")||{},s=new QR(t,n);t.add.existing(s),s.on("folder.expand",(function(){s.setExpandedState(!0);})).on("folder.collapse",(function(){s.setExpandedState(!1);}));var r={root:nL(i,"root"),styles:nL(i,"tweaker"),space:nL(i,"space")||{}},o=tL(t,r),a=nL(i,"background"),h=eL(t,0,a),l=new iL(t,{orientation:1,title:s,child:o,background:h,transition:{duration:nL(i,"transition.duration",200)}});return t.add.existing(l),l}(e,0,i);delete i.tweaker,delete i.root,this.add(n,{expand:!0}),n.setTitle(t);var s=sL(t,"expanded",!0);void 0!==s&&n.setExpandedState(s);var r=n.getElement("child");return t.key&&this.root.addChildrenMap(t.key,r),r},addTab:function(t){var e=this.scene,i=hL(this.styles,"tab")||{};i.tweaker=this.styles,i.root=this.root;var n=function(t,e,i){var n=new oL(t,i);t.add.existing(n);for(var s=aL(i,"tab"),r={root:aL(i,"root"),styles:aL(i,"tweaker")},o=aL(e,"pages")||[],a=0,h=o.length;a<h;a++){var l=o[a];n.addPage({key:l.title,tab:_S(t,s).setActiveState(!1).resetDisplayContent({text:l.title}),page:tL(t,r)});}return n.on("tab.focus",(function(t,e){t.setActiveState(!0);})).on("tab.blur",(function(t,e){t.setActiveState(!1);})),n}(e,t,i);delete i.tweaker,delete i.root,this.add(n,{expand:!0});for(var s=hL(t,"pages")||[],r=[],o=0,a=0,h=s.length;a<h;a++){var l=n.getPage(a);s[a].show&&(o=a);var u=s[a].key;u&&this.root.addChildrenMap(u,l),r.push(l);}return n.swapPage(o,0),r},addInput:function(t,e,i){1===arguments.length?(t=(i=t).bindingTarget,e=i.bindingKey):(void 0===i&&(i={}),i.bindingTarget=t,i.bindingKey=e),i.title||(i.title=e),i.bindingTarget&&i.bindingKey?i.value=i.bindingTarget[i.bindingKey]:i.value=void 0;var n=this.styles.inputRow||{};n.parentOrientation=this.styles.orientation;var s=yL.call(this,this.scene,i,n);if(!s)return console.error("[Tweaker] Can't add Input\n    title: ".concat(i.title,"\n    view: ").concat(i.view,"\n")),this;var r,o=s.childrenMap.inputField;return 1===this.orientation?r=0:(r=this.itemWidth>0?0:1,s.setMinWidth(this.itemWidth)),this.add(s,{proportion:r,expand:!0}),i.onValueChange&&o.on("valuechange",i.onValueChange),s.setAutoUpdateEnable(i.autoUpdate),s.setBindingTarget(t,e),i.monitor&&s.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,s),this},addButtons:function(t){var e=this.scene;void 0===t&&(t={});var i=t.bindingTarget;delete t.bindingTarget;var n=xL(this.styles,"inputRow")||{},s=bL(e,t,n);return this.add(s,{expand:!0}),i&&s.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,s),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){var e=this.scene,i=CL(this.styles,"separator"),n=eL(e,0,i);return this.add(n,{expand:!0}),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,n=e.length;i<n;i++){var s=e[i];s.setBindingTarget&&s.setBindingTarget(t);}return this},getMaxInputRowTitleWidth:function(){for(var t=0,e=this.sizerChildren,i=0,n=e.length;i<n;i++){var s=e[i];s.rexSizer.hidden||(s.getMinTitleWidth?t=Math.max(t,s.getMinTitleWidth()):s.getMaxInputRowTitleWidth&&(t=Math.max(t,s.getMaxInputRowTitleWidth())));}return t+this.getInnerPadding("left")},setInputRowTitleWidth:function(t){t-=this.getInnerPadding("left");for(var e=this.sizerChildren,i=0,n=e.length;i<n;i++){var s=e[i];s.rexSizer.hidden||(s.setMinTitleWidth?s.setMinTitleWidth(t):s.setInputRowTitleWidth&&s.setInputRowTitleWidth(t));}return this}},SL=Phaser.Utils.Objects.GetValue,PL=function(e){function i(e,n){var s;if(h(this,i),void 0===n&&(n={}),void 0===n.orientation&&(n.orientation=1),(s=t(this,i,[e,n])).type="rexTweakerShell",s.root=n.root||v(s),s.styles=SL(n,"styles")||{},s.styles.orientation=s.orientation,s.itemWidth=SL(s.styles,"itemWidth",0),s.root===v(s)&&1===s.orientation){var r=SL(n,"inputRow.alignTitle");if(void 0===r)r=!SL(s.styles,"inputRow.proportion.title");else r&&Q(s.styles,"inputRow.proportion.title",0);s.alignInputRowTitle=r;}else s.alignInputRowTitle=!1,s.inputHandlers=s.root.inputHandlers;var o=eL(e,0,n.background);return o&&s.addBackground(o),s}return d(i,e),u(i,[{key:"preLayout",value:function(){m(f(i.prototype),"preLayout",this).call(this),this.alignInputRowTitle&&this.setInputRowTitleWidth(this.getMaxInputRowTitleWidth());}}]),i}(Ex);Object.assign(PL.prototype,wL);var TL={name:"TextInput",accept:function(t){return t.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value},build:function(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var n=e.inputText,s=I_(i,n);t.add(s,{proportion:1,expand:!0,key:"inputText"}),s.on("close",(function(){t.setValue(s.value);}));},setup:function(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.getElement("inputText").setReadOnly(e);}(t,!!e.inputTextReadOnly);},displayValue:function(t,e){t.getElement("inputText").setText(t.getFotmatText(e));}},OL={name:"TextAreaInput",accept:function(t){return !!t.hasOwnProperty("view")&&"textarea"===t.view},build:function(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var n=e.inputTextArea;void 0===n&&(n={}),n.hasOwnProperty("text")||(n.text=e.inputText),n.hasOwnProperty("slider")||(n.slider=e.slider);var s=function(t,e,i){void 0===i&&(i=!0),i?e=e?R(e):{}:e||(e={});var n=new f_(t,e);return t.add.existing(n),n}(i,n);t.add(s,{proportion:1,expand:!0,key:"inputText"}),s.on("close",(function(){t.setValue(s.value);}));},setup:function(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.getElement("inputText").setReadOnly(e);}(t,!!e.inputTextReadOnly);},displayValue:function(t,e){t.getElement("inputText").setText(t.getFotmatText(e));}},ML={name:"NumberInput",accept:function(t){return t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value},build:function(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var n=e.inputNumber||e.inputText,s=I_(i,n).setNumberInput();t.add(s,{proportion:1,expand:!0,key:"inputText"}),s.on("close",(function(){t.setValue(s.value);}));},setup:function(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.getElement("inputText").setReadOnly(e);}(t,!!e.inputTextReadOnly);},displayValue:function(t,e){t.getElement("inputText").setText(t.getFotmatText(e));}},EL=Phaser.Utils.Objects.GetValue,_L=Phaser.Math.Linear,RL=Phaser.Math.Snap.Floor,LL={name:"RangeInput",accept:function(t){return t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max")},build:function(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var n=e.slider,s=0===t.orientation?"track.height":"track.width",r=EL(n,s),o=function(t,e){var i=new gP(t,e);return t.add.existing(i),i}(i,n),a=1===e.parentOrientation?2:0,h=EL(e,"proportion.range.slider",a),l=void 0===r;t.add(o,{proportion:h,expand:l,key:"slider"});var u=e.inputNumber||e.inputText,c=I_(i,u).setNumberInput();a=1===e.parentOrientation?1:0,h=EL(e,"proportion.range.inputText",a);t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value);})),o.on("valuechange",(function(){var e=_L(t.minValue,t.maxValue,o.value);t.step&&(e=RL(e,t.step,t.minValue)),t.setValue(e);}));},setup:function(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,n){t.minValue=e,t.maxValue=i,t.step=n,t.getElement("slider").setGap(n,e,i);}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.getElement("inputText").setReadOnly(e);}(t,!!e.inputTextReadOnly);},displayValue:function(t,e){t.getElement("slider").setValue(e,t.minValue,t.maxValue),t.getElement("inputText").setText("").setText(t.getFotmatText(e));}},BL={name:"ColorInput",accept:function(t){return !!t.hasOwnProperty("view")&&"color"===t.view},build:function(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var n=e.colorInput;void 0===n&&(n={}),n.hasOwnProperty("inputText")||(n.inputText=e.inputText);var s=function(t,e,i){void 0===i&&(i=!0),i?e=e?R(e):{}:e||(e={});var n=new ER(t,e);return t.add.existing(n),n}(i,n);t.add(s,{proportion:1,expand:!0,key:"colorInput"}),s.on("valuechange",(function(e){t.setValue(e);}));},displayValue:function(t,e){t.getElement("colorInput").setValue(e);}},DL={name:"CheckboxInput",accept:function(t){return t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value},build:function(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var n=e.checkbox,s=function(t,e){var i=new Tc(t,e);return t.add.existing(i),i}(i,n),r=n.size;void 0!==r&&s.setSize(r,r);var o=void 0!==r?0:1;t.add(s,{proportion:0,expand:!1,fitRatio:o,key:"checkbox"}),s.on("valuechange",(function(e){t.setValue(e);}));},displayValue:function(t,e){t.getElement("checkbox").setValue(e);}},IL={name:"ToggleSwitchInput",accept:function(t){return !!t.hasOwnProperty("view")&&"toggleSwitch"===t.view},build:function(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var n=e.toggleSwitch,s=function(t,e){var i=new Wc(t,e);return t.add.existing(i),i}(i,n),r=n.size;void 0!==r&&s.setSize(r,r);var o=void 0!==r?0:1;t.addSpace().add(s,{proportion:0,expand:!1,fitRatio:o,key:"toggleSwitch"}),s.on("valuechange",(function(e){t.setValue(e);}));},displayValue:function(t,e){t.getElement("toggleSwitch").setValue(e);}},jL=function(t,e){for(var i=0,n=t.length;i<n;i++){if(t[i].value===e)return i}},zL={name:"ListInput",accept:function(t){return t.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options")},build:function(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var n=function(t,e){e=QO(t,e);var i=new $O(t,e);return t.add.existing(i),i}(i,e.list);t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,n,s,r,o){t.setValue(n.value);}));},setup:function(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.getElement("list").setOptions(e);}(t,e.options);},displayValue:function(t,e){var i=t.getElement("list"),n=function(t,e){var i=jL(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(n).setMinSize(i.width,i.height).layout().setMinSize(0,0);}},AL=Phaser.Utils.Objects.GetValue,FL={name:"ButtonsInput",accept:function(t){return !!t.hasOwnProperty("view")&&"buttons"===t.view},build:function(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var n=e.button?R(e.button):{},s=AL(n,"expand",!0);s&&(n.align="center"),delete n.expand;var r=function(t,e){var i=new iS(t,e);return t.add.existing(i),i}(i,{expand:s});r.buttonConfig=n,t.add(r,{proportion:1,expand:!0,key:"list"}),r.on("button.click",(function(e,i,n,s){var o=r.options[i];o&&(t._selectedIndex=i,t.setValue(o.value),t._selectedIndex=void 0);}));},setup:function(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.getElement("list");i.options=e;var n=t.scene,s=i.buttonConfig;i.clearButtons(!0);for(var r=0,o=e.length;r<o;r++){var a=e[r],h=_S(n,s).setActiveState(!1).resetDisplayContent({text:a.text});i.addButton(h);}}(t,e.options);},displayValue:function(t,e){var i=t.getElement("list"),n=t._selectedIndex;void 0===n&&(n=jL(i.options,e)),function(t,e){for(var i=0,n=t.length;i<n;i++){var s=t[i];s&&s.setActiveState(i===e);}}(i.getElement("buttons"),n);}},WL=function(){this.registerInputHandler(TL).registerInputHandler(OL).registerInputHandler(ML).registerInputHandler(LL).registerInputHandler(BL).registerInputHandler(DL).registerInputHandler(IL).registerInputHandler(zL).registerInputHandler(FL);},VL=function(e){function i(e,n){var s;return h(this,i),void 0===n&&(n={}),n.hasOwnProperty("style")&&(n.styles=n.style),void 0===n.styles&&(n.styles={}),n.background=n.styles.background||{},n.space=n.styles.space||{},(s=t(this,i,[e,n])).type="rexTweaker",s.inputHandlers=[],WL.call(v(s)),s}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(m(f(i.prototype),"destroy",this).call(this,t),this.inputHandlers=void 0);}}]),i}(PL);E.register("tweaker",(function(t){var e=new VL(this.scene,t);return this.scene.add.existing(e),e})),Q(window,"RexPlugins.UI.Tweaker",VL),E.register("click",(function(t,e){return new wc(t,e)})),Q(window,"RexPlugins.UI.Click",wc),E.register("clickOutside",(function(t,e){return new sy(t,e)})),Q(window,"RexPlugins.UI.ClickOutside",sy),E.register("inTouching",(function(t,e){return new ly(t,e)})),Q(window,"RexPlugins.UI.InTouching",ly),E.register("tap",(function(t,e){return Nf(t)||(e=t,t=this.scene),new Ly(t,e)})),Q(window,"RexPlugins.UI.Tap",Ly),E.register("press",(function(t,e){return Nf(t)||(e=t,t=this.scene),new zy(t,e)})),Q(window,"RexPlugins.UI.Press",zy),E.register("swipe",(function(t,e){return Nf(t)||(e=t,t=this.scene),new Qy(t,e)})),Q(window,"RexPlugins.UI.Swipe",Qy),E.register("pan",(function(t,e){return Nf(t)||(e=t,t=this.scene),new Yy(t,e)})),Q(window,"RexPlugins.UI.Pan",Yy),E.register("drag",(function(t,e){return new DR(t,e)})),Q(window,"RexPlugins.UI.Drag",DR),E.register("pinch",(function(t){return new pm(this.scene,t)})),Q(window,"RexPlugins.UI.Pinch",pm),E.register("rotate",(function(t){return new Tm(this.scene,t)})),Q(window,"RexPlugins.UI.Rotate",Tm);var YL=Phaser.Utils.Objects.IsPlainObject,GL=Phaser.Utils.Objects.GetValue,XL=function(t,e,i){var n;if(void 0===t)t=i.texture.key,e=i.frame.name;else if(YL(t)){var s=t;t=GL(s,"key",i.texture.key),e=GL(s,"frame",i.frame.name);}else "string"==typeof t||(n=t);return void 0===n&&(n=function(i){i.setTexture(t,e);}),n},HL=Phaser.Utils.Objects.GetValue,UL=Phaser.Utils.Objects.GetAdvancedValue,NL=Phaser.Math.Linear,KL=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).resetFromJSON(n),s.boot(),s}return d(i,e),u(i,[{key:"resetFromJSON",value:function(t){return m(f(i.prototype),"resetFromJSON",this).call(this,t),this.setDuration(UL(t,"duration",500)),this.setEase(HL(t,"ease","Sine")),this.setOrientation(HL(t,"orientation",0)),this.setFrontFace(HL(t,"front",void 0)),this.setBackFace(HL(t,"back",void 0)),this.setFace(HL(t,"face",0)),this}},{key:"setOrientation",value:function(t){return "string"==typeof t&&(t=JL[t]),this.orientation=t,this}},{key:"face",get:function(){return this._face},set:function(t){"string"==typeof t&&(t=qL[t]),this._face=t,0===t&&this.frontFaceCallback?this.frontFaceCallback(this.parent):1===t&&this.backFaceCallback&&this.backFaceCallback(this.parent);}},{key:"setFace",value:function(t){return this.face=t,this}},{key:"toggleFace",value:function(){var t=0===this.face?1:0;return this.setFace(t),this}},{key:"setFrontFace",value:function(t,e){return this.frontFaceCallback=XL(t,e,this.parent),this}},{key:"setBackFace",value:function(t,e){return this.backFaceCallback=XL(t,e,this.parent),this}},{key:"start",value:function(){if(this.timer.isRunning)return this;var t=this.parent;return 0===this.orientation?this.scale0=t.scaleX:this.scale0=t.scaleY,this.timer.setDelay(this.delay).setDuration(this.duration/2).setRepeat(1),m(f(i.prototype),"start",this).call(this),this}},{key:"flip",value:function(t){return this.isRunning||(void 0!==t&&this.setDuration(t),this.start()),this}},{key:"updateGameObject",value:function(t,e){e.justRestart&&this.toggleFace();var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i);var n=NL(this.scale0,0,i);0===this.orientation?t.scaleX=n:t.scaleY=n;}}]),i}(zo),JL={x:0,horizontal:0,y:1,vertical:1},qL={front:0,back:1};E.register("flip",(function(t,e){return new KL(t,e)})),Q(window,"RexPlugins.UI.Flip",KL),E.register("shake",(function(t,e){return new Kv(t,e)})),Q(window,"RexPlugins.UI.Shake",Kv),E.register("touchEventStop",(function(t,e){return new Og(t,e)})),Q(window,"RexPlugins.UI.TouchEventStop",Og),E.register("perspective",(function(t,e){return new yE(t,e)})),Q(window,"RexPlugins.UI.Perspective",yE);var ZL=Phaser.Math.RotateAround,$L=function(t,e,i){var n=t.width/2,s=t.height/2;return QL.x=e-n,QL.y=i-s,ZL(QL,0,0,t.rotation),QL.x*=t.scaleX,QL.y*=t.scaleY,QL.x+=t.x,QL.y+=t.y,QL},QL={x:0,y:0},tB=function(){function t(e,i){h(this,t),this.parent=e,this.vertex=i,this._localX=void 0,this._localY=void 0;}return u(t,[{key:"destroy",value:function(){this.parent=void 0,this.vertex=void 0;}},{key:"updateVertexPosition",value:function(t,e){var i=this.parent,n=i.height,s=t/n-i.frame.cutWidth/n/2,r=e/n-i.frame.cutHeight/n/2,o=this.vertex;return o.x=s,o.y=-r,i.forceUpdate(),this}},{key:"localX",get:function(){return this._localX},set:function(t){this.setLocalXY(t,this._localY);}},{key:"localY",get:function(){return this._localY},set:function(t){this.setLocalXY(this._localX,t);}},{key:"localXOrigin",get:function(){return this._localXOrigin}},{key:"localYOrigin",get:function(){return this._localYOrigin}},{key:"resetLocalXY",value:function(t,e){return this._localXOrigin=t,this._localYOrigin=e,this._localX=t,this._localY=e,this}},{key:"setLocalXY",value:function(t,e,i){return this._localX===t&&this._localY===e||(this._localX=t,this._localY=e,i||this.updateVertexPosition(t,e)),this}},{key:"setWorldXY",value:function(t,e){if(this._worldX===t&&this._worldY===e)return this;var i=function(t,e,i){var n=t.width/2,s=t.height/2;return QL.x=e-t.x,QL.y=i-t.y,QL.x/=t.scaleX,QL.y/=t.scaleY,ZL(QL,0,0,-t.rotation),QL.x+=n,QL.y+=s,QL}(this.parent,t,e);return this.setLocalXY(i.x,i.y),this}},{key:"setPosition",value:function(t,e){return this.setWorldXY(t,e),this}},{key:"getWorldXY",value:function(){return $L(this.parent,this._localX,this._localY)}},{key:"x",get:function(){return $L(this.parent,this._localX,this._localY).x},set:function(t){this.setWorldXY(t,this.y);}},{key:"y",get:function(){return $L(this.parent,this._localX,this._localY).y},set:function(t){this.setWorldXY(this.x,t);}}]),t}(),eB=Phaser.Geom.Mesh.Vertex,iB=Phaser.Geom.Mesh.Face,nB=[0,2,3,0,3,1],sB=[1,3,2,1,2,0],rB=[0,3,4,0,4,1,1,4,2,4,5,2,3,6,4,6,7,4,4,7,8,4,8,5],oB=Phaser.Utils.Objects.IsPlainObject,aB=Phaser.Utils.Objects.GetValue,hB=function(e){function i(e,n,s,r,o,a){var l;return h(this,i),oB(n)&&(n=aB(a=n,"x",0),s=aB(a,"y",0),r=aB(a,"key",null),o=aB(a,"frame",null)),(l=t(this,i,[e,n,s,r,o])).type="rexQuadImage",l.isNinePointMode=aB(a,"ninePointMode",!1),l.fourPointsModeRTL=aB(a,"rtl",!1),l.controlPoints=[],function(t){for(var e,i=t.isNinePointMode,n=i?9:4,s=t.vertices,r=t.faces,o=t.controlPoints,a=0;a<n;a++){var h=new eB;s.push(h),o.push(new tB(t,h));}a=0;for(var l=(e=i?rB:t.fourPointsModeRTL?sB:nB).length;a<l;a+=3){var u=s[e[a+0]],c=s[e[a+1]],d=s[e[a+2]];r.push(new iB(u,c,d));}i?(t.topLeft=o[0],t.topCenter=o[1],t.topRight=o[2],t.centerLeft=o[3],t.center=o[4],t.centerRight=o[5],t.bottomLeft=o[6],t.bottomCenter=o[7],t.bottomRight=o[8]):(t.topLeft=o[0],t.topRight=o[1],t.bottomLeft=o[2],t.bottomRight=o[3]);}(v(l)),l.hideCCW=!1,l.syncSize(),l}return d(i,e),u(i,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){m(f(i.prototype),"destroy",this).call(this,t);for(var e=0,n=this.controlPoints.length;e<n;e++)this.controlPoints[e].destroy();this.controlPoints=void 0;}}},{key:"resetVerts",value:function(){this.dirtyCache[9]=-1;for(var t=function(t){var e,i=t.height,n=t.width;if(t.isNinePointMode){var s=(0+n)/2,r=(0+i)/2;e=[0,0,s,0,n,0,0,r,s,r,n,r,0,i,s,i,n,i];}else e=[0,0,n,0,0,i,n,i];return e}(this),e=this.width,i=this.height,n=this.frame.cutWidth/i/2,s=this.frame.cutHeight/i/2,r=this.frame.u0,o=this.frame.u1,a=this.frame.v0,h=o-r,l=this.frame.v1-a,u=this.controlPoints,c=0,d=t.length;c<d;c+=2){var f=t[c+0],p=t[c+1],v=c/2,g=f/i-n,y=p/i-s,m=r+h*(f/e),k=a+l*(p/i);this.vertices[v].set(g,-y,0).setUVs(m,k),u[v].resetLocalXY(f,p);}return this}},{key:"syncSize",value:function(){return this.setSizeToFrame(),this.setOrtho(this.width/this.height,1),this.resetVerts(),this}}]),i}(RM);Phaser.Utils.Objects.IsPlainObject,Phaser.Utils.Objects.GetValue;var lB=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0);for(var n=.5*t.width,s=.5*t.height,r=Math.tan(e)*s,o=Math.tan(i)*n,a=t.controlPoints,h=0,l=a.length;h<l;h++){var u=a[h],c=u.localXOrigin,d=u.localYOrigin;u.localX=c+(d>s?r:-r),u.localY=d+(c>n?o:-o);}},uB=Phaser.Utils.Objects.IsPlainObject,cB=Phaser.Utils.Objects.GetValue,dB=Phaser.Math.DegToRad,fB=Phaser.Math.RadToDeg,pB=function(e){function i(e,n,s,r,o){var a;if(h(this,i),uB(n)){var l=n;n=cB(l,"x",0),s=cB(l,"y",0),r=cB(l,"key",null),o=cB(l,"frame",null);}return (a=t(this,i,[e,n,s,r,o])).type="rexSkewmage",a._skewX=0,a._skewY=0,a}return d(i,e),u(i,[{key:"skewX",get:function(){return this._skewX},set:function(t){this._skewX=t,lB(this,this._skewX,this._skewY);}},{key:"skewXDeg",get:function(){return fB(this._skewX)},set:function(t){this.skewX=dB(t);}},{key:"skewY",get:function(){return this._skewY},set:function(t){this._skewY=t,lB(this,this._skewX,this._skewY);}},{key:"skewYDeg",get:function(){return fB(this._skewY)},set:function(t){this.skewY=dB(t);}},{key:"setSkewX",value:function(t){return this.skewX=t,this}},{key:"setSkewY",value:function(t){return this.skewY=t,this}},{key:"setSkew",value:function(t,e){return void 0===e&&(e=t),this.skewX=t,this.skewY=e,this}},{key:"setSkewXDeg",value:function(t){return this.skewXDeg=t,this}},{key:"setSkewYDeg",value:function(t){return this.skewYDeg=t,this}},{key:"setSkewDeg",value:function(t,e){return void 0===e&&(e=t),this.skewXDeg=t,this.skewYDeg=e,this}}]),i}(hB),vB=Phaser.Utils.Objects.IsPlainObject,gB=Phaser.Utils.Objects.GetValue,yB=function(e){function i(){return h(this,i),t(this,i,arguments)}return d(i,e),u(i,[{key:"skewState",get:function(){return this.isRunning}}]),i}(gE(function(e){function i(e,n,s,r,o){var a;if(h(this,i),vB(n)){var l=n;n=gB(l,"x",0),s=gB(l,"y",0),r=gB(l,"width",32),o=gB(l,"height",32);}return (a=t(this,i,[e,n,s,HM(e,r,o),null])).type="rexSkewRenderTexture",a.rt=a.texture,a}return d(i,e),u(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(m(f(i.prototype),"destroy",this).call(this,t),this.rt.destroy(),this.rt=null);}}]),i}(pB)));E.register("skew",(function(t,e){return new yB(t,e)})),Q(window,"RexPlugins.UI.Skew",yB),E.register("anchor",(function(t,e){return new fv(t,e)})),Q(window,"RexPlugins.UI.Anchor",fv),E.register("textTyping",(function(t,e){return new fM(t,e)})),Q(window,"RexPlugins.UI.TextTyping",fM),E.register("textPage",(function(t,e){return new lM(t,e)})),Q(window,"RexPlugins.UI.TextPage",lM);var mB=void 0,kB=Phaser.Utils.Objects.GetValue,bB=Phaser.Utils.Objects.Clone,xB=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"},CB=Phaser.Utils.Objects.GetValue,wB=Phaser.Utils.Objects.Merge,SB={open:function(t,e){var i;void 0===t&&(t={}),t=wB(t,this.openConfig),(i=this)!==mB&&(void 0!==mB&&mB.close(),mB=i),Gg(t)&&(e=t,t=void 0);var n=CB(t,"inputType",void 0);void 0===n&&(n=CB(t,"type","text")),void 0===e&&(e=CB(t,"onClose",void 0));var s=CB(t,"onOpen",void 0),r=CB(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={}),e=bB(e);var i=t.scene,n=t.style,s=kB(e,"backgroundColor",n.backgroundColor);null===s&&(s="transparent"),e.text=kB(e,"text",t.text),e.fontFamily=kB(e,"fontFamily",n.fontFamily),e.fontSize=kB(e,"fontSize",n.fontSize),e.color=kB(e,"color",n.color),e.backgroundColor=s,e.direction=kB(e,"rtl",n.rtl)?"rtl":"ltr",e.align=kB(e,"align",xB(n)),"rtl"===e.direction&&sw(t)&&(e.align="right");var r=new Vb(i,t.x,t.y,kB(e,"width",t.width),kB(e,"height",t.height),e);r.setScale(t.scaleX,t.scaleY).setOrigin(t.originX,t.originY).setScrollFactor(t.scrollFactorX,t.scrollFactorY);var o=t.parentContainer;return o?o.add(r):i.add.existing(r),r}(this.parent,t).on("textchange",(function(t){var e=t.text;r?r(this.parent,e):this.parent.text=e;}),this).setFocus(),this.parent.setVisible(!1),this.onClose=e,CB(t,"enterClose","textarea"!==n)&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.delayCall=function(t,e,i){return t.time.delayedCall(0,e,[],i)}(this.scene,(function(){this.scene.input.once("pointerdown",this.close,this),s&&s(this.parent),this.emit("open",this.parent);}),this),this},close:function(){return this===mB&&(mB=void 0),this.parent.setVisible(!0),this.inputText&&(this.inputText.destroy(),this.inputText=void 0),this.delayCall&&(this.delayCall.remove(),this.delayCall=void 0),this.scene.input.keyboard.off("keydown-ENTER",this.close,this),this.scene.input.off("pointerdown",this.close,this),this.onClose&&this.onClose(this.parent),this.emit("close",this.parent),this}},PB=Phaser.Utils.Objects.GetValue,TB=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e])).inputText=void 0,s.onClose=void 0,s.delayCall=void 0,s.setOpenConfig(n),PB(n,"clickEnable",!0)&&e.on("pointerdown",(function(){this.open();}),v(s)).setInteractive(),s}return d(i,e),u(i,[{key:"shutdown",value:function(t){this.isShutdown||(this.close(),m(f(i.prototype),"shutdown",this).call(this,t));}},{key:"setOpenConfig",value:function(t){return void 0===t&&(t={}),this.openConfig=t,this}},{key:"isOpened",get:function(){return void 0!==this.inputText}},{key:"text",get:function(){return this.isOpened?this.inputText.text:this.parent.text}}]),i}(mo);Object.assign(TB.prototype,SB);E.register("textEdit",(function(t,e){return new TB(t,e)})),Q(window,"RexPlugins.UI.TextEdit",TB);var OB=65535,MB=function(t,e,i){if(null==e)return t;if(0===e)return RB(t,0,i),t;var n=t.text.length;if(0===n)return RB(t,e,i),t;var s=Math.floor(1.5*e/n);void 0!==i&&s>i&&(s=Math.floor(i));for(var r={},o=_B(t,s,e,i,r),a=0;a<=OB&&0!==o;a++){if((s+=o)<0){s=0;break}o=_B(t,s,e,i,r);}return a===OB&&console.warn("FontSizeFit: Test count exceeds ".concat(OB)),t.setFontSize(s),RB(t,e,i),t},EB=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},_B=function(t,e,i,n,s){var r,o=EB(t,e,s),a=EB(t,e+1,s);if(void 0!==n)if(o.height<=n&&a.height>n)r=0;else {if(o.height>n)return -1;r=Math.floor(n-o.height);}if(o.width<=i&&a.width>i)return 0;if(o.width>i)return -1;var h=Math.floor(i-o.width);return void 0===r?h:Math.min(h,r)},RB=function(t,e,i){var n=t.style;n&&(n.fixedWidth=e,n.parent.width=e,void 0!==i&&(n.fixedHeight=i,n.parent.height=i),n.update(!1));},LB=Phaser.Utils.Objects.GetValue,BB=function(e){function i(e,n){var s;return h(this,i),(s=t(this,i,[e,n])).add=new E(e),s}return d(i,Phaser.Plugins.ScenePlugin),u(i,[{key:"start",value:function(){this.scene.events.on("destroy",this.destroy,this);}},{key:"isInTouching",value:function(t,e,i,n){return !!t.visible&&Hg(t,e,i,n)}},{key:"viewport",get:function(){return ao(this.scene,this.scene.cameras.main,!0)}}]),i}(),DB={getParentSizer:$d,getTopmostSizer:Qd,removeFromParent:kT,hide:sg,show:ng,isShown:rg,confirmAction:yT,edit:function(t,e,i){return t._edit||(t._edit=new TB(t,{clickEnable:!1})),t._edit.open(e,i),t._edit},wrapExpandText:rw,fontSizeExpandText:function(t,e){"number"==typeof e&&(e={minWidth:e});var i=LB(e,"minWidth",0),n=LB(e,"minHeight",0),s=LB(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=n,s?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return MB(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),MB(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t},fontSizeResize:MB,setFontSizeToFitWidth:MB,waitEvent:Ih,waitComplete:jh,delayPromise:Xb,setChildrenInteractive:Am,fadeIn:_v,fadeOutDestroy:Rv,easeMoveTo:Vv,easeMoveFrom:Yv,modal:Vg,modalPromise:function(t,e){var i=Vg(t,e);return new Promise((function(t,e){i.once("close",(function(e){t(e);}));}))},modalClose:Yg,requestDrag:_R,openFileChooser:Kb};return Object.assign(BB.prototype,DB),BB}));
